This is a discussion on a question on performance degradation -- multiple windows andobserver service - Mozilla ; All, Wonder if any of you have seen this, and if so, know of a solution. Trying to do a very simple global notification to all windows in case there is a state change in one of the windows. The ...
All,
Wonder if any of you have seen this, and if so, know
of a solution.
Trying to do a very simple global notification to all
windows in case there is a state change in one of the
windows.
The simplest case is a toggle button which goes ON or
OFF.
However, with 2 windows, noticing a pretty severe
performance degradation (and ultimately hanging) if
the toggle button is clicked 5-10 times from each
window.
Any ideas?
Thanks for your help!
Cheers,
AM
--
code fragment:
var newSetting= "..."; // currently, "ON" or "OFF"
var obsService =
Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverServi ce);
obsService.notifyObservers(null, "am-setting-changed",
newSetting);
--
The observer looks at the value of the third
parameter, and sets its own window's global variable
to it.
There is also a shared-singleton-component that holds
newSetting; however, have commented it out to see if
the performance issue will go away, but it doesn't.