From 76b20be2ea0b95bf700b36df39a5678f8ba7fcc1 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 21 Oct 2014 00:26:34 +0200 Subject: [PATCH] Qt provider --- qt.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 qt.js diff --git a/qt.js b/qt.js new file mode 100644 index 000000000..214a0ee23 --- /dev/null +++ b/qt.js @@ -0,0 +1,15 @@ +(function() { + var QtProvider = function() {}; + QtProvider.prototype.send = function(payload) { + navigator.qt.postData(JSON.stringify(payload)); + }; + Object.defineProperty(QtProvider.prototype, "onmessage", { + set: function(handler) { + navigator.qt.onmessage = handler; + }, + }); + + if(typeof(web3) !== "undefined" && web3.providers !== undefined) { + web3.QtProvider = QtProvider; + } +})();