I have JavaScript array which is consists of many objects.
var array=[{name:1},{name:2}.....]
I want to use Object.observe
to handle data changes on each of these objects.
Is there any way to apply something like event delegation here , in order to not apply observe
for each of objects?
If I use Object.observe
for array itself than changing its items doesn't trigger anything.
No, that's not possible.
Imagine code like this:
Would changing
foo
trigger your callback now? Or only modifications tobar[0]
? When you usebar[0]
the object is retrieved frombar
but besides that it has no association withbar
whatsoever.