diff options
Diffstat (limited to 'data/util.js')
-rw-r--r-- | data/util.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/data/util.js b/data/util.js index 09360a0..6c5e7b0 100644 --- a/data/util.js +++ b/data/util.js @@ -251,3 +251,29 @@ function removeDuplicates (arr) { } return arr; } + +// ============================================ +/** + * object to pack messaging. Use as in + postMessage(new Message("GetPassword", { + login: login, + hostname: location.hostname + })); + */ +function Message(cmd, data) { + this.cmd = cmd; + this.data = data; +} + +function log(msg) { + postMessage(new Message("LogMessage", msg)); +} + +var NotLoggedinException = function NotLoggedinException (message) { + this.message = message; + this.name = "NotLoggedinException"; +}; + +NotLoggedinException.prototype.toString = function () { + return this.name + ': "' + this.message + '"'; +}; |