October 2006
Intermediate to advanced
288 pages
5h 55m
English
The next method is the unregisterObserver method, which is used to remove observers from the collection so that they are no longer notified when an event occurs. Listing 16.4 shows the method as it is used in ErrorManager.
ErrorManager.unregisterObserver = function(_observer)
{
for(var observer in ErrorManager.observerCollection)
{
if(_observer == ErrorManager.observerCollection[observer])
{
ErrorManager.observerCollection.splice(observer, 1);
}
}
}
|
This method receives a codestring as did the registerObserver method. It then uses this string while iterating through the collection by checking to see whether there is a matching codestring in the collection. When and ...
Read now
Unlock full access