WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WONTFIX
3659
Add Support for the watch() method of Object
https://bugs.webkit.org/show_bug.cgi?id=3659
Summary
Add Support for the watch() method of Object
David Wheeler
Reported
2005-06-22 19:22:48 PDT
I think that the watch() method of the Object class is a Netscape-specific add-on not included in the ECMAScript spec, but it's amazingly useful. I have a workaround for this using setTimeout(), but the watch () method is more elegant and timely. The watch() method (and the corresponding unwatch() method) is documented in the URL included in this bug report, but in short, it allows one to trigger a function whenever an object attribute is changed in order to trigger other actions, change the value to be assigned, or whatever. Think of it as a callback on an attribute assigment callback. It's supported by FireFox. Not sure about IE/Windows.
Attachments
_Old_ work in progress patch
(11.42 KB, patch)
2008-02-15 23:16 PST
,
Anders Carlsson
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Mark Rowe (bdash)
Comment 1
2005-06-22 23:21:24 PDT
A quick check verifies that this method is not present in the ECMA specification, and is not supported by IE 6.0.
David Wheeler
Comment 2
2005-06-23 08:28:09 PDT
Yes, I found the same, Mark. Thanks. Here's to hoping that it makes it into the ECMA 4.0 spec! Hrm, don't see it in the current draft...pity.
http://www.mozilla.org/js/language/es4.html
Joost de Valk (AlthA)
Comment 3
2005-06-23 09:55:31 PDT
sounds reasonable to me! confirming.
Rob Moore
Comment 4
2006-08-23 16:08:13 PDT
Just FYI, IE does support a similar concept -- the propertychange event:
http://msdn.microsoft.com/workshop/author/dhtml/reference/events/onpropertychange.asp
Anders Carlsson
Comment 5
2008-02-15 23:16:57 PST
Created
attachment 19152
[details]
_Old_ work in progress patch I found an old patch that implements this, maybe parts of it can be used.
Gavin Barraclough
Comment 6
2012-09-11 18:02:15 PDT
A variant on this theme is now gaining traction with TC-39, with is Object.observe / Object.makeObservable. Mozilla's documentation also warns against the use of watch. In light of this, I don't think we want to implement watch. This is a useful feature, and I think we should closely track progress of the Object.observe / Object.makeObservable proposals.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug