mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
Merge b23e5b63f5 into fdecc11128
This commit is contained in:
commit
a6086b12bb
7 changed files with 16 additions and 16 deletions
|
|
@ -40,23 +40,23 @@
|
||||||
document.querySelector("#id").innerHTML = id;
|
document.querySelector("#id").innerHTML = id;
|
||||||
document.querySelector("#known").innerHTML = shh.haveIdentity(id);
|
document.querySelector("#known").innerHTML = shh.haveIdentity(id);
|
||||||
|
|
||||||
var watch = shh.watch({topics: ["test"]})
|
var watch = shh.watch({topic: ["test"]})
|
||||||
watch.arrived(function(message) {
|
watch.arrived(function(message) {
|
||||||
document.querySelector("#table").innerHTML += "<tr><td colspan='2'>"+JSON.stringify(message)+"</td></tr>";
|
document.querySelector("#table").innerHTML += "<tr><td colspan='2'>"+JSON.stringify(message)+"</td></tr>";
|
||||||
});
|
});
|
||||||
|
|
||||||
var selfWatch = shh.watch({to: id, topics: ["test"]})
|
var selfWatch = shh.watch({to: id, topic: ["test"]})
|
||||||
selfWatch.arrived(function(message) {
|
selfWatch.arrived(function(message) {
|
||||||
document.querySelector("#table").innerHTML += "<tr><td>To me</td><td>"+JSON.stringify(message)+"</td></tr>";
|
document.querySelector("#table").innerHTML += "<tr><td>To me</td><td>"+JSON.stringify(message)+"</td></tr>";
|
||||||
});
|
});
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
shh.post({topics: ["test"], payload: web3.fromAscii("test it")});
|
shh.post({topic: ["test"], payload: web3.fromAscii("test it")});
|
||||||
count();
|
count();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test2() {
|
function test2() {
|
||||||
shh.post({to: id, topics: ["test"], payload: web3.fromAscii("Private")});
|
shh.post({to: id, topic: ["test"], payload: web3.fromAscii("Private")});
|
||||||
count();
|
count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -659,9 +659,9 @@ var Filter = function(options, impl) {
|
||||||
|
|
||||||
if (typeof options !== "string") {
|
if (typeof options !== "string") {
|
||||||
|
|
||||||
// topics property is deprecated, warn about it!
|
// topic property is deprecated, warn about it!
|
||||||
if (options.topics) {
|
if (options.topic) {
|
||||||
console.warn('"topics" is deprecated, use "topic" instead');
|
console.warn('"topic" is deprecated, use "topic" instead');
|
||||||
}
|
}
|
||||||
|
|
||||||
this._onWatchResult = options._onWatchEventResult;
|
this._onWatchResult = options._onWatchEventResult;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -32,9 +32,9 @@ var Filter = function(options, impl) {
|
||||||
|
|
||||||
if (typeof options !== "string") {
|
if (typeof options !== "string") {
|
||||||
|
|
||||||
// topics property is deprecated, warn about it!
|
// topic property is deprecated, warn about it!
|
||||||
if (options.topics) {
|
if (options.topic) {
|
||||||
console.warn('"topics" is deprecated, use "topic" instead');
|
console.warn('"topic" is deprecated, use "topic" instead');
|
||||||
}
|
}
|
||||||
|
|
||||||
this._onWatchResult = options._onWatchEventResult;
|
this._onWatchResult = options._onWatchEventResult;
|
||||||
|
|
|
||||||
|
|
@ -384,11 +384,11 @@ Rectangle {
|
||||||
params[fields[i]] = params[fields[i]] || "";
|
params[fields[i]] = params[fields[i]] || "";
|
||||||
}
|
}
|
||||||
if(typeof params.payload !== "object") { params.payload = [params.payload]; } //params.payload = params.payload.join(""); }
|
if(typeof params.payload !== "object") { params.payload = [params.payload]; } //params.payload = params.payload.join(""); }
|
||||||
params.topics = params.topics || [];
|
params.topic = params.topic || [];
|
||||||
params.priority = params.priority || 1000;
|
params.priority = params.priority || 1000;
|
||||||
params.ttl = params.ttl || 100;
|
params.ttl = params.ttl || 100;
|
||||||
|
|
||||||
shh.post(params.payload, params.to, params.from, params.topics, params.priority, params.ttl);
|
shh.post(params.payload, params.to, params.from, params.topic, params.priority, params.ttl);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,13 +44,13 @@ Rectangle {
|
||||||
placeholderText: "Data"
|
placeholderText: "Data"
|
||||||
}
|
}
|
||||||
TextField {
|
TextField {
|
||||||
id: topics
|
id: topic
|
||||||
placeholderText: "topic1, topic2, topic3, ..."
|
placeholderText: "topic1, topic2, topic3, ..."
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
text: "Send"
|
text: "Send"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
shh.post([eth.toHex(data.text)], "", identity, topics.text.split(","), 500, 50)
|
shh.post([eth.toHex(data.text)], "", identity, topic.text.split(","), 500, 50)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue