문제

I would like to detect if any of an object's property has changed. Something like:

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

Is this somehow possible?

도움이 되었습니까?

해결책

You could use some JS plugins like Watch JS. this keep tracks of whole object changes or even if a single attribute has changed.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top