diff options
author | Marian OANCΞA <contact@siteshop.ro> | 2014-11-11 23:20:53 +0800 |
---|---|---|
committer | Marian OANCΞA <contact@siteshop.ro> | 2014-11-11 23:20:53 +0800 |
commit | d85cef557bf3a312097544c27fe54fdf745f1e11 (patch) | |
tree | a4dc794d580de2139eb9a5831058778fe88c3c0a /lib/qt.js | |
parent | dea68f073e9a071e3e3940f7a467bf3cdc8d1992 (diff) | |
parent | 838ca2fd9393e5b3cd4423934de78f1b8f9fd13f (diff) | |
download | dexon-d85cef557bf3a312097544c27fe54fdf745f1e11.tar dexon-d85cef557bf3a312097544c27fe54fdf745f1e11.tar.gz dexon-d85cef557bf3a312097544c27fe54fdf745f1e11.tar.bz2 dexon-d85cef557bf3a312097544c27fe54fdf745f1e11.tar.lz dexon-d85cef557bf3a312097544c27fe54fdf745f1e11.tar.xz dexon-d85cef557bf3a312097544c27fe54fdf745f1e11.tar.zst dexon-d85cef557bf3a312097544c27fe54fdf745f1e11.zip |
Merge pull request #8 from debris/autoprovider
Autoprovider
Diffstat (limited to 'lib/qt.js')
-rw-r--r-- | lib/qt.js | 33 |
1 files changed, 17 insertions, 16 deletions
@@ -16,29 +16,30 @@ */ /** @file qt.js * @authors: + * Jeffrey Wilcke <jeff@ethdev.com> * Marek Kotewicz <marek@ethdev.com> * @date 2014 */ - var QtProvider = function() { - this.handlers = []; +var QtProvider = function() { + this.handlers = []; - var self = this; - navigator.qt.onmessage = function (message) { - self.handlers.forEach(function (handler) { - handler.call(self, JSON.parse(message.data)); - }); - }; + var self = this; + navigator.qt.onmessage = function (message) { + self.handlers.forEach(function (handler) { + handler.call(self, JSON.parse(message.data)); + }); }; +}; - QtProvider.prototype.send = function(payload) { - navigator.qt.postMessage(JSON.stringify(payload)); - }; +QtProvider.prototype.send = function(payload) { + navigator.qt.postMessage(JSON.stringify(payload)); +}; - Object.defineProperty(QtProvider.prototype, "onmessage", { - set: function(handler) { - this.handlers.push(handler); - } - }); +Object.defineProperty(QtProvider.prototype, "onmessage", { + set: function(handler) { + this.handlers.push(handler); + } +}); module.exports = QtProvider; |