changed topics to topic

This commit is contained in:
Fabian Vogelsteller 2015-02-19 10:55:56 +01:00
parent 487c5cc294
commit b23e5b63f5
7 changed files with 16 additions and 16 deletions

View file

@ -40,23 +40,23 @@
document.querySelector("#id").innerHTML = id;
document.querySelector("#known").innerHTML = shh.haveIdentity(id);
var watch = shh.watch({topics: ["test"]})
var watch = shh.watch({topic: ["test"]})
watch.arrived(function(message) {
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) {
document.querySelector("#table").innerHTML += "<tr><td>To me</td><td>"+JSON.stringify(message)+"</td></tr>";
});
function test() {
shh.post({topics: ["test"], payload: web3.fromAscii("test it")});
shh.post({topic: ["test"], payload: web3.fromAscii("test it")});
count();
}
function test2() {
shh.post({to: id, topics: ["test"], payload: web3.fromAscii("Private")});
shh.post({to: id, topic: ["test"], payload: web3.fromAscii("Private")});
count();
}

View file

@ -659,9 +659,9 @@ var Filter = function(options, impl) {
if (typeof options !== "string") {
// topics property is deprecated, warn about it!
if (options.topics) {
console.warn('"topics" is deprecated, use "topic" instead');
// topic property is deprecated, warn about it!
if (options.topic) {
console.warn('"topic" is deprecated, use "topic" instead');
}
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

View file

@ -32,9 +32,9 @@ var Filter = function(options, impl) {
if (typeof options !== "string") {
// topics property is deprecated, warn about it!
if (options.topics) {
console.warn('"topics" is deprecated, use "topic" instead');
// topic property is deprecated, warn about it!
if (options.topic) {
console.warn('"topic" is deprecated, use "topic" instead');
}
this._onWatchResult = options._onWatchEventResult;

View file

@ -384,11 +384,11 @@ Rectangle {
params[fields[i]] = params[fields[i]] || "";
}
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.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;

View file

@ -44,13 +44,13 @@ Rectangle {
placeholderText: "Data"
}
TextField {
id: topics
id: topic
placeholderText: "topic1, topic2, topic3, ..."
}
Button {
text: "Send"
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)
}
}
}