检测Javascript对象中的更改 [英] Detecting change in a Javascript Object

查看:168
本文介绍了检测Javascript对象中的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现这个要点来检测对象的指定字段的更改: https://gist.github.com/ 3138469

I found this gist to detect changes on specified fiels of a object : https://gist.github.com/3138469

但它仅在一个字段上绑定一个事件。

But it bind an event only on one field.

有人知道一个函数或检查整个Javascript对象的变化的技巧

Someone know a function or a tricks to detect change on an entire Javascript Object ?

推荐答案

当我想实现这个时,我通常使用 Watch.js ,您可以观看整个对象或一个属性。

When I want to achieve this I usually use Watch.js, you can watch a whole object or one attribute.

更新:我刚刚注意到,Watch.js的作者正在引用一个具有更广泛浏览器支持的库。 MultiGetSet.JS

Update: I've just noticed that the author of Watch.js is referencing a library with much broader browsers' support. MultiGetSet.JS

这篇关于检测Javascript对象中的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆