Talk:FUEL/0.1/Plan: Difference between revisions
MarkFinkle (talk | contribs) No edit summary |
No edit summary |
||
| Line 7: | Line 7: | ||
Good luck whatever you do! :-) | Good luck whatever you do! :-) | ||
[[User:GijsKruitbosch|GijsKruitbosch]] 23:38, 7 January 2007 (PST) | [[User:GijsKruitbosch|GijsKruitbosch]] 23:38, 7 January 2007 (PST) | ||
'''Re:Preferences''' | |||
Lightning just wraps the getting/setting of prefs, if you're looking for something more lightweight: | |||
http://landfill.mozilla.org/mxr-test/mozilla/source/calendar/resources/content/calendarUtils.js#150 | |||
(You could even typeof(aValue) to avoid an extra argument for setPref().) -jminta | |||
Revision as of 04:51, 10 January 2007
This seems interesting. A couple of points:
- Please do this in a Toolkit way, not in a Browser way. That is, I should be able to use the same simplified API in Thunderbird and/or any Toolkit (XULRunner) app. If this is not possible, extension devs will keep relying on existing (complicated) APIs because those do provide that compatibility.
- Have a look at some existing implementations. For example, ChatZilla/Venkman wrap preferences in a way much like what you describe, though there's more of a sacrifice made there to achieve ease of use by doing a less lightweight implementation. See http://lxr.mozilla.org/seamonkey/source/extensions/irc/js/lib/pref-manager.js
I'm also curious on how you would implement the Service thing. AFAICT, it would be impractical to keep all existing services around on an object - that is, it'd create a bunch of them the JS probably never needs. Implementing this using getters means you keep re-getting the service if you use the API like the example does. (ie, Service.Foo.stuff(bar); Service.Foo.unstuff(bar); ) This would probably be slow(er). Or so I'd presume, I haven't tested any of this.
Good luck whatever you do! :-) GijsKruitbosch 23:38, 7 January 2007 (PST)
Re:Preferences Lightning just wraps the getting/setting of prefs, if you're looking for something more lightweight: http://landfill.mozilla.org/mxr-test/mozilla/source/calendar/resources/content/calendarUtils.js#150 (You could even typeof(aValue) to avoid an extra argument for setPref().) -jminta
Regarding the services, I was thinking about a singleton pattern to cache the service after the first "get":
// somewhere in the impl
_os : null,
Observer() : function() {
if (_os == null) {
// get the service from XPCOM
}
return _os;
}
Thanks for the feedback and ideas. Keep it coming! MarkFinkle 19:30, 9 January 2007 (PST)