Javascript Array观察

时间:2016-11-24 14:42:49

标签: javascript riot.js

与riot.js一起观察(arr,回调)

但是当我尝试观察我的数组时,我得到 Array.observe不是函数

Array.observe(this.nodes, function (changes) 
{
    //do some stuff
    tag.update();
});

错误

Uncaught TypeError: Array.observe is not a function(…)(anonymous function)
@components/breadcrumb-navigation.tag.js:3(anonymous function) 
@ riot+compiler.js:1604(anonymous function) 
@ riot+compiler.js:1719each 
@ riot+compiler.js:1921toggle 
@ riot+compiler.js:1719(anonymous function) 
@ riot+compiler.js:1610mountTo 
@ riot+compiler.js:2417pushTags 
@ riot+compiler.js:2557each 
@ riot+compiler.js:1921pushTags 
@ riot+compiler.js:2561riot.mount 
@ riot+compiler.js:2612(anonymous function) 
@ riot+compiler.js:3497done 
@ riot+compiler.js:3414compileTag 
@ riot+compiler.js:3421GET.req.onreadystatechange 
@ riot+compiler.js:3381

1 个答案:

答案 0 :(得分:2)

Array.observe方法已过时,已被删除 建议使用Proxy