创建嵌套节点
var app = gun.get('app');
var node = app.get('watcher/1').put({"stats":{"num":3},"name":"trex"});
收听更新
app.get('watcher/' + id).get('stats').on(function (v, k) {
console.log('v:', v);
console.log('k:', k);
});
获取网页加载更新(devtools 控制台输出)
(index):62 v: {"_":{"#":"j9782ilz019k9aUsJJj5c8Q5O",">":{"num":1508946976437}},"num":3}
(index):63 k: stats
更新节点
app.get('watcher/1').put({"stats":{"num":4},"name":"trexxx"});
控制台中没有更新!
jsfiddle 演示:https ://jsfiddle.net/sergibondarenko/e6ctqaqL/69/