JQuery: detecting changes in object properties

I would like to determine if any property of the object has changed. Sort of:

var object = { property: 'value' };
$(object).onPropertyChange(function(property, newValue){
    console.log('object changed: ', property, newValue);
})

How is this possible?

+4
source share
1 answer

You can use some JS plugins like Watch JS . this tracks changes to the entire object or even if one attribute has changed.

+4
source

Source: https://habr.com/ru/post/1537639/


All Articles