Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__nosuchmethod__类似需求没有被支持 #3

Open
defims opened this issue Dec 7, 2015 · 2 comments
Open

__nosuchmethod__类似需求没有被支持 #3

defims opened this issue Dec 7, 2015 · 2 comments

Comments

@defims
Copy link

defims commented Dec 7, 2015

var arr = [1,2,3];
observe(arr, function() {console.log("change")});
arr[3] = 2;
var obj = {a:1,b:2};
observe(obj, function() {console.log("change")});
obj.c = 3;

如果直接使用未定义的键的操作相关的监测事件未触发,如果在实际使用中要一直避免访问到未定义的键,那使用起来需很谨慎

polymer的observerjs通过暴露一个Platform.performMicrotaskCheckpoint()接口手动刷新,其余的方案采用定时器机制检查

@lanstonpeng
Copy link

或许可以在observejs上层再包装一层,检测之后在调用其函数

@jddy
Copy link

jddy commented Dec 12, 2015

是的,这个未定义的东东。。。。不知道有什么大坑没有
还有个问题,就是取消监控,貌似木有?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants