aboutsummaryrefslogtreecommitdiffstats
path: root/lib/qt.js
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-16 00:27:07 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-16 00:27:07 +0800
commit6d02c0d392762203dc150203ce0f315654aed5c2 (patch)
treee6c51635dae8245effc9b570de4f8cb00a117b1c /lib/qt.js
parent508f116738517efc8c21233e9d50349ba30e223c (diff)
parentec74fc05d438806ece64fe34b0f28c8f45f5167e (diff)
downloadgo-tangerine-6d02c0d392762203dc150203ce0f315654aed5c2.tar
go-tangerine-6d02c0d392762203dc150203ce0f315654aed5c2.tar.gz
go-tangerine-6d02c0d392762203dc150203ce0f315654aed5c2.tar.bz2
go-tangerine-6d02c0d392762203dc150203ce0f315654aed5c2.tar.lz
go-tangerine-6d02c0d392762203dc150203ce0f315654aed5c2.tar.xz
go-tangerine-6d02c0d392762203dc150203ce0f315654aed5c2.tar.zst
go-tangerine-6d02c0d392762203dc150203ce0f315654aed5c2.zip
Merge commit '1a6dbeff6e86d65cae6d7db366cbaa4182eaff7f' into ethereumjs
Conflicts: libjsqrc/ethereumjs/dist/ethereum.js libjsqrc/ethereumjs/dist/ethereum.js.map libjsqrc/ethereumjs/dist/ethereum.min.js libjsqrc/ethereumjs/lib/abi.js
Diffstat (limited to 'lib/qt.js')
-rw-r--r--lib/qt.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/qt.js b/lib/qt.js
index f02239547..1b3a9547b 100644
--- a/lib/qt.js
+++ b/lib/qt.js
@@ -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);