aboutsummaryrefslogtreecommitdiffstats
path: root/ethereal/assets
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-04-26 07:47:04 +0800
committerobscuren <geffobscura@gmail.com>2014-04-26 07:47:04 +0800
commite16fd323e800297602a60b7a0e7b7897a55d2fa0 (patch)
tree1c27a3bc225af36d6b0b2117ba6b649cc3983110 /ethereal/assets
parentd0438ac10ab55cd12c1ab5ec3aaf0030185bf131 (diff)
downloaddexon-e16fd323e800297602a60b7a0e7b7897a55d2fa0.tar
dexon-e16fd323e800297602a60b7a0e7b7897a55d2fa0.tar.gz
dexon-e16fd323e800297602a60b7a0e7b7897a55d2fa0.tar.bz2
dexon-e16fd323e800297602a60b7a0e7b7897a55d2fa0.tar.lz
dexon-e16fd323e800297602a60b7a0e7b7897a55d2fa0.tar.xz
dexon-e16fd323e800297602a60b7a0e7b7897a55d2fa0.tar.zst
dexon-e16fd323e800297602a60b7a0e7b7897a55d2fa0.zip
Leverage the new watch & address:changed functionality
Diffstat (limited to 'ethereal/assets')
-rw-r--r--ethereal/assets/ethereum.js4
-rw-r--r--ethereal/assets/qml/webapp.qml12
-rw-r--r--ethereal/assets/samplecoin.html5
3 files changed, 19 insertions, 2 deletions
diff --git a/ethereal/assets/ethereum.js b/ethereal/assets/ethereum.js
index fefad584a..0f9f68c43 100644
--- a/ethereal/assets/ethereum.js
+++ b/ethereal/assets/ethereum.js
@@ -47,6 +47,10 @@ window.eth = {
postData({call: "getKey"}, cb);
},
+ watch: function(address) {
+ postData({call: "watch", args: [address]});
+ },
+
on: function(event, cb) {
if(eth._onCallbacks[event] === undefined) {
diff --git a/ethereal/assets/qml/webapp.qml b/ethereal/assets/qml/webapp.qml
index 9cf154e9b..c34e0dc55 100644
--- a/ethereal/assets/qml/webapp.qml
+++ b/ethereal/assets/qml/webapp.qml
@@ -74,14 +74,24 @@ ApplicationWindow {
var keys = eth.getKey()
postData(data._seed, keys)
break
+ case "watch":
+ if(data.args.length > 0) {
+ eth.watch(data.args[0]);
+ }
}
}
function postData(seed, data) {
webview.experimental.postMessage(JSON.stringify({data: data, _seed: seed}))
}
+ function postEvent(event, data) {
+ webview.experimental.postMessage(JSON.stringify({data: data, _event: event}))
+ }
function onNewBlockCb(block) {
- webview.experimental.postMessage(JSON.stringify({data: block, _event: "block:new"}))
+ postEvent("block:new", block)
+ }
+ function onObjectChangeCb(stateObject) {
+ postEvent("object:change", stateObject)
}
}
diff --git a/ethereal/assets/samplecoin.html b/ethereal/assets/samplecoin.html
index 476283f60..1b89be877 100644
--- a/ethereal/assets/samplecoin.html
+++ b/ethereal/assets/samplecoin.html
@@ -22,12 +22,15 @@ function tests() {
}
function init() {
+ eth.watch(jefcoinAddr);
+
eth.getKey(function(key) {
eth.getStorage(jefcoinAddr, key, function(storage) {
document.querySelector("#currentAmount").innerHTML = "Amount: " + storage;
});
- eth.on("block:new", function() {
+ eth.on("object:change", function(stateObject) {
+ debug(stateObject);
eth.getStorage(jefcoinAddr, key, function(storage) {
document.querySelector("#currentAmount").innerHTML = "Amount: " + storage;
});