plugeth/mist/assets/ext/qt_messaging_adapter.js

22 lines
425 B
JavaScript
Raw Normal View History

window._messagingAdapter = function(data) {
navigator.qt.postMessage(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];
}
}
}
}