Closed
Bug 266172
Opened 20 years ago
Closed 14 years ago
devguru.com - Example code for Object.watch is wrong
Categories
(Tech Evangelism Graveyard :: English US, defect)
Tech Evangelism Graveyard
English US
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
People
(Reporter: timeless, Assigned: timeless)
References
()
Details
METHOD: Object::watch Netscape Only Feature
Object.watch(property, handlerfunction)
The watch method is inherited by every object descended from Object and adds a
watchpoint to a property of the method. Whenever a value is assigned to it, it
calls up a function allowing you to watch any new value assigned and, if
necessary, alter it.
For example, this following code watches the 'name' property of the 'city'
object, and if the name 'Leningrad' is assigned to it, it is altered to the
city's new name of 'St. Petersburg'. Note the code that is enclosed in the pair
of curly braces (an if statement) which is associated with the handlerfunction
argument called 'myfunction':
Code:
city = {name:"Chicago"}
city.watch("name", myfunction (property, oldval, newval)
{
if(newval == "Leningrad")
newval = "St. Petersburg"
return newval
}
) //end of watch method
--
the code should say:
city.watch("name", function myfunction (property, oldval, newval)
{
if(newval == "Leningrad")
newval = "St. Petersburg"
return newval
}
) //end of watch method
Comment 1•20 years ago
|
||
Conforming summary to TFM item 10 at http://www.mozilla.org/projects/tech-evangelism/site/procedures.html#file-new
Summary: Example code for Object.watch is wrong → devguru.com - Example code for Object.watch is wrong
Comment 2•17 years ago
|
||
Yep. Timeless, did you ever contact them to let them know?
Assignee: english-us → timeless
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows XP → All
Hardware: PC → All
Comment 3•14 years ago
|
||
INCOMPLETE due to lack of activity since the end of 2009. If someone is willing to investigate the issues raised in this bug to determine whether they still exist, *and* work with the site in question to fix any existing issues, please feel free to re-open and assign to yourself. Sorry for the bugspam; filter on "NO MORE PRE-2010 TE BUGS" to remove.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → INCOMPLETE
Updated•10 years ago
|
Product: Tech Evangelism → Tech Evangelism Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•