tag:blogger.com,1999:blog-34454975.post6045454947530333798..comments2023-06-28T16:58:41.189+02:00Comments on Web Reflection: Internet Explorer Object watchAndrea Giammarchihttp://www.blogger.com/profile/16277820774810688474noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-34454975.post-5670323040813137002014-01-21T23:07:00.205+01:002014-01-21T23:07:00.205+01:00I don't think this post is updated enough so I...I don't think this post is updated enough so I think it's not a solution at all ... not even sure if still works.<br /><br />However, what you are looking for is `Object.observe` in Chrome or `Proxy`, both should land via ES6 soon as JavaScript core functionality.<br /><br />I hope this answer helped.Andrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-21725662420827817412014-01-21T19:02:11.382+01:002014-01-21T19:02:11.382+01:00Hi Andrea,
I'm trying to find a good way to ...Hi Andrea, <br /><br />I'm trying to find a good way to implement an object.watch functionality. The event chain in my application relies on it. I tried the Eli Grey polyfill, but it gave me some issues witch the variables becoming inaccessible. I wondered what your thought at the present time are about the watch function. Do you think your function is still considered a good practice? <br /><br />wkr,<br /><br />JerryMattmohttps://www.blogger.com/profile/01141599374701895511noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-65714524487368657062010-12-28T16:27:38.081+01:002010-12-28T16:27:38.081+01:00doesn't work at all
no errors but no result
f...doesn't work at all<br />no errors but no result<br /><br /><b>function myObj()<br /> {<br /> this.towatch=false;<br /> manWatcher=createWatcher(this);<br /> manWatcher.watch("towatch",function(){alert("ok");});<br /> }<br /> <br /> var z=new myObj();<br /> z.towatch=true;</b>Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-44387578376647515832009-01-12T17:44:00.000+01:002009-01-12T17:44:00.000+01:00Anonymous, this is the MDC explanation of the watc...Anonymous, this is the MDC explanation of the watch Object prototype: <A HREF="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Object/watch" REL="nofollow">Object watch</A><BR/><BR/>while for the other question, yes, the last version is compatible with Opera and Safari and probably others.Andrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-23535636145060518602009-01-12T16:46:00.000+01:002009-01-12T16:46:00.000+01:00Could you please explain this "watcher" concept ag...Could you please explain this "watcher" concept again. Also, is your implementation cross-browser compat?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-76328685508041419472009-01-11T14:19:00.000+01:002009-01-11T14:19:00.000+01:00Luke, I implemented a destroy method to remove the...Luke, I implemented a destroy method to remove the element and/or callbacks and solve memory leaks problem plus I have implemented an Opera / Safari version.<BR/><BR/>The script is beta but seems to work properly ;-)Andrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-69463033597497909822009-01-11T12:54:00.000+01:002009-01-11T12:54:00.000+01:00Luke, the indexOf was for another test I did but I...Luke, the indexOf was for another test I did but I forgot to remove it from the code, thanks.<BR/><BR/>I could not find a way to automatically clean everything on watcher delete and any sugestion will be appreciated.<BR/><BR/>Opera and Safari, as far as I know, supports __defineSetter__ and __defineGetter__, am I wrong? I could extend the function to those browsers as well ( right now I think Opera could work without problems, but I did not test :) )Andrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-60354444929225506972009-01-11T08:00:00.000+01:002009-01-11T08:00:00.000+01:00Interesting! I wonder why the wrapping function p...Interesting! I wonder why the wrapping function passing indexOf, since it's not used in the closure.<BR/><BR/>Shame the added DOM nodes won't get cleaned up when the watched object is GCd. Could lead to some serious memory leakage if used in a loop or high traffic util function.<BR/><BR/>I suppose neither Opera nor Safari have any comparable path?Unknownhttps://www.blogger.com/profile/03685381148030258146noreply@blogger.com