嵌套对象未更新

时间:2017-10-25 16:09:16

标签: javascript gun

创建嵌套节点

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 demo:https://jsfiddle.net/sergibondarenko/e6ctqaqL/69/

1 个答案:

答案 0 :(得分:1)

@trex这是您找到的错误,现在已修复为v0.8.9 +。