I would like to extend localStorage
by executing some code each time a setting is fetched/stored. I could define a getter/setter for all existing properties of localStorage
, but the problem lies in new settings.
For example, localStorage['somenewsetting'] = 123
creates a new setting. I would like to automatically define a getter/setter for this property so that my addition code is also executed for new settings.
Basically I need Object.watch
, but for all properties. What I found was __noSuchMethod__
, but it is not available on Chrome. Is there any shim available for this method? Or is there another way of watching all properties of an object?
Again, I need to make this work on Chrome.