diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-14 19:01:11 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-14 19:01:11 +0800 |
commit | 12bdb5f5509c205a7a868e02964ed25d10f4b000 (patch) | |
tree | a27f0a6f91434a5920719ed2209e524fe6982d19 /lib/qt.js | |
parent | 8d1f96cc0aa608c319a48af5a3c2397b694d5930 (diff) | |
download | go-tangerine-12bdb5f5509c205a7a868e02964ed25d10f4b000.tar go-tangerine-12bdb5f5509c205a7a868e02964ed25d10f4b000.tar.gz go-tangerine-12bdb5f5509c205a7a868e02964ed25d10f4b000.tar.bz2 go-tangerine-12bdb5f5509c205a7a868e02964ed25d10f4b000.tar.lz go-tangerine-12bdb5f5509c205a7a868e02964ed25d10f4b000.tar.xz go-tangerine-12bdb5f5509c205a7a868e02964ed25d10f4b000.tar.zst go-tangerine-12bdb5f5509c205a7a868e02964ed25d10f4b000.zip |
providers documentation
Diffstat (limited to 'lib/qt.js')
-rw-r--r-- | lib/qt.js | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -21,6 +21,11 @@ * @date 2014 */ +/** + * QtProvider object prototype is implementing 'provider protocol' + * Should be used inside ethereum browser. It's compatible with cpp and go clients. + * It uses navigator.qt object to pass the messages to native bindings + */ var QtProvider = function() { this.handlers = []; @@ -32,10 +37,17 @@ var QtProvider = function() { }; }; +/// Prototype object method +/// Should be called when we want to send single api request to native bindings +/// Asynchronous +/// Response will be received by navigator.qt.onmessage method and passed to handlers +/// @param payload is inner message object QtProvider.prototype.send = function(payload) { navigator.qt.postMessage(JSON.stringify(payload)); }; +/// Prototype object property +/// Should be used to set message handlers for this provider Object.defineProperty(QtProvider.prototype, "onmessage", { set: function(handler) { this.handlers.push(handler); |