canmove, Confirmed users, Bureaucrats and Sysops emeriti
2,798
edits
MarkFinkle (talk | contribs) (added random thoughts on code) |
MarkFinkle (talk | contribs) |
||
Line 39: | Line 39: | ||
Accessing services/interfaces/components should be easier. We could allow shorthand access like this: | Accessing services/interfaces/components should be easier. We could allow shorthand access like this: | ||
<pre> | <pre> | ||
var prefService = Components.classes["@mozilla.org/preferences-service;1"] | var prefService = Components.classes["@mozilla.org/preferences-service;1"] | ||
.getService(Components.interfaces.nsIPrefBranch2); | .getService(Components.interfaces.nsIPrefBranch2); | ||
Line 82: | Line 82: | ||
var cs = MOZILLA.ConsoleService(); | var cs = MOZILLA.ConsoleService(); | ||
</pre> | </pre> | ||
Developers seem to have problems with observer notifications. When they are fired, or what significance of the notification. There are also problems with determining what is an event (addEventListener) and what is a notification (addObserver). Basically, developers want to know when a resource is available (UI element or service) and what event or notification they need to use to figure that out. | |||
What if we provided a means to hook developer code to an event/notification without needing to know the details of the element or notification name. Something like: | |||
<pre> | |||
MOZILLA.DelayedExecute("xpcom-services-started", doMyStartup); | |||
MOZILLA.DelayedExecute("browser-services-started", doMyRefresh); | |||
MOZILLA.DelayedExecute("browser-ui-loaded", doMyToolbarSetup); | |||
MOZILLA.DelayedExecute("quit-application-granted", doMyShutdown); | |||
</pre> | |||
We would create a maintained list of "events" that would be mapped to events/notifications in the toolkit and browser. |