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; + } +})();