Detect when a new property is added to a Javascript object?

Posted by UICodes on Stack Overflow See other posts from Stack Overflow or by UICodes
Published on 2010-05-05T17:24:22Z Indexed on 2010/05/05 17:28 UTC
Read the original article Hit count: 271

Filed under:
|
|

A simple example using a built-in javascript object: navigator.my_new_property = "some value"; //can we detect that this new property was added?

I don't want to constantly poll the object to check for new properties. Is there some type of higher level setter for objects instead of explicitly stating the property to monitor?

Again, I don't want to detect if the property value changed, but rather when a new property is added.

Ideas? thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about object