From aec3e26ea0074842ca36a5d918cc3ed049a547cf Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 21 Apr 2014 00:58:02 +0200 Subject: [PATCH] Round one HTML external applications using QML(Qt5) WebKit2 w/o native bindings --- ethereal/assets/ethereum.js | 48 +++++++++++++++++++ ethereal/assets/qml/webapp.qml | 85 ++++++++++++++++++++++++++++++++++ ethereal/assets/test.html | 27 +++++++++++ 3 files changed, 160 insertions(+) create mode 100644 ethereal/assets/ethereum.js create mode 100644 ethereal/assets/qml/webapp.qml create mode 100644 ethereal/assets/test.html diff --git a/ethereal/assets/ethereum.js b/ethereal/assets/ethereum.js new file mode 100644 index 0000000000..b8908913d1 --- /dev/null +++ b/ethereal/assets/ethereum.js @@ -0,0 +1,48 @@ +// Helper function for generating pseudo callbacks and sending data to the QML part of the application +function postData(data, cb) { + data._seed = Math.floor(Math.random() * 1000000) + if(cb) { + eth._callbacks[data._seed] = cb; + } + + navigator.qt.postMessage(JSON.stringify(data)); +} + +// Main Ethereum library +window.eth = { + prototype: Object(), + + send: function(cb) { + document.getElementById("out").innerHTML = "clicked"; + postData({message: "Hello world"}, cb); + } +} +window.eth._callbacks = {} + +function debug(/**/) { + var args = arguments; + var msg = "" + for(var i=0; i + +Epic Works (TM) + +

It just works!

+ +

Play with me...

+ + +
+
+
+ + + + + +