diff options
author | obscuren <geffobscura@gmail.com> | 2014-10-01 05:26:16 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-10-01 05:26:16 +0800 |
commit | 6db40ecb22c28a777f4ab1cd4de5a12e41ac669d (patch) | |
tree | d444855839bf2e498dc9c4724928c7eb07cf6c22 /mist/assets/ext/html_messaging.js | |
parent | 41ae6f298e079a073282de001e6b1eaa51472638 (diff) | |
download | go-tangerine-6db40ecb22c28a777f4ab1cd4de5a12e41ac669d.tar go-tangerine-6db40ecb22c28a777f4ab1cd4de5a12e41ac669d.tar.gz go-tangerine-6db40ecb22c28a777f4ab1cd4de5a12e41ac669d.tar.bz2 go-tangerine-6db40ecb22c28a777f4ab1cd4de5a12e41ac669d.tar.lz go-tangerine-6db40ecb22c28a777f4ab1cd4de5a12e41ac669d.tar.xz go-tangerine-6db40ecb22c28a777f4ab1cd4de5a12e41ac669d.tar.zst go-tangerine-6db40ecb22c28a777f4ab1cd4de5a12e41ac669d.zip |
WebSocket interface
Web sockets handlers fully implemented. Filter handlers have yet to be
implemented.
Diffstat (limited to 'mist/assets/ext/html_messaging.js')
-rw-r--r-- | mist/assets/ext/html_messaging.js | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/mist/assets/ext/html_messaging.js b/mist/assets/ext/html_messaging.js index 1f9418148..91310e998 100644 --- a/mist/assets/ext/html_messaging.js +++ b/mist/assets/ext/html_messaging.js @@ -1,9 +1,8 @@ // The magic return variable. The magic return variable will be set during the execution of the QML call. (function(window) { - function message(type, data) { - document.title = JSON.stringify({type: type, data: data}); - - return window.____returnData; + var Promise = window.Promise; + if(typeof(Promise) === "undefined") { + var Promise = Q.Promise; } function isPromise(o) { @@ -446,6 +445,7 @@ } }); + var g_seed = 1; function postData(data, cb) { data._seed = g_seed; @@ -459,24 +459,6 @@ g_seed++; - navigator.qt.postMessage(JSON.stringify(data)); - } - - navigator.qt.onmessage = function(ev) { - var data = JSON.parse(ev.data) - - if(data._event !== undefined) { - eth.trigger(data._event, data.data); - } else { - if(data._seed) { - var cb = eth._callbacks[data._seed]; - if(cb) { - cb.call(this, data.data) - - // Remove the "trigger" callback - delete eth._callbacks[ev._seed]; - } - } - } + window._messagingAdapter.call(this, JSON.stringify(data)) } })(this); |