aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/mist/assets/ext/eth.js/qt.js
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-20 09:34:12 +0800
committerobscuren <geffobscura@gmail.com>2014-12-20 09:34:12 +0800
commit3983dd2428137211f84f299f9ce8690c22f50afd (patch)
tree3a2dc53b365e6f377fc82a3514150d1297fe549c /cmd/mist/assets/ext/eth.js/qt.js
parent7daa8c2f6eb25511c6a54ad420709af911fc6748 (diff)
parent0a9dc1536c5d776844d6947a0090ff7e1a7c6ab4 (diff)
downloadgo-tangerine-vv0.7.10.tar
go-tangerine-vv0.7.10.tar.gz
go-tangerine-vv0.7.10.tar.bz2
go-tangerine-vv0.7.10.tar.lz
go-tangerine-vv0.7.10.tar.xz
go-tangerine-vv0.7.10.tar.zst
go-tangerine-vv0.7.10.zip
Merge branch 'release/v0.7.10'vv0.7.10
Diffstat (limited to 'cmd/mist/assets/ext/eth.js/qt.js')
-rw-r--r--cmd/mist/assets/ext/eth.js/qt.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/cmd/mist/assets/ext/eth.js/qt.js b/cmd/mist/assets/ext/eth.js/qt.js
new file mode 100644
index 000000000..644c37737
--- /dev/null
+++ b/cmd/mist/assets/ext/eth.js/qt.js
@@ -0,0 +1,27 @@
+(function() {
+ 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));
+ });
+ }
+ };
+
+ QtProvider.prototype.send = function(payload) {
+ navigator.qt.postMessage(JSON.stringify(payload));
+ };
+
+ Object.defineProperty(QtProvider.prototype, "onmessage", {
+ set: function(handler) {
+ this.handlers.push(handler);
+ },
+ });
+
+ if(typeof(web3) !== "undefined" && web3.providers !== undefined) {
+ web3.providers.QtProvider = QtProvider;
+ }
+})();
+