FUEL (Firefox User Extension Library) is a JavaScript Library designed to help developers build extensions using terminology and interfaces that are familiar to them.
Application
) to reduce need for <script>getService
)nsIObserverService
) are somewhat orthognal to DOM events (addEventListener
)// global prefs Application.prefs.get("my.pref", default); Application.prefs.set("my.pref","foo"); // extension-level prefs uses the extension id as a branch extension.prefs.set("autosave", true);
// global prefs Application.storage.get("name", default); Application.storage.set("name","foo"); // extension-level prefs uses the extension id as a branch extension.storage.set("autosave", true);
Application.events.addListener("ready", function() { /* display message */ } ); Application.events.addListener("quit", function() { /* save data */ } ); Application.storage.events.addListener("change", function() { } ); Application.prefs.events.addListener("change", function() { } ); extension.events.addListener("uninstall", function() { /* cleanup prefs */ } );
Application.bookmarks.all.forEach( function(b) { // look at each bookmark }); Application.bookmarks.events("add", function() { /* new bookmark added */ } ); Application.bookmarks.events("remove", function() { /* bookmark removed */ } ); Application.bookmarks.events("change", function() { /* bookmark changed */ } );
Application.browsers.forEach( fucntion(b) { // look at each open browser window (not tab) }); Application.activeBrowser.tabs.forEach( function(t) { // look at each open tab in the active browser window }); // opens a new tab in the browser window var tab = browser.open("http://mozilla.org"); // make sure the new tab is visible in the browser window tab.focus();
Modern UI designs utilize animations and visual ques