forked from cerc-io/plugeth
6db40ecb22
Web sockets handlers fully implemented. Filter handlers have yet to be implemented.
22 lines
425 B
JavaScript
22 lines
425 B
JavaScript
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];
|
|
}
|
|
}
|
|
}
|
|
}
|