Download - Fuel - Firefox 3 (June '07)
![Page 1: Fuel - Firefox 3 (June '07)](https://reader035.vdocuments.site/reader035/viewer/2022081816/545c9befb1af9f3c0a8b47e9/html5/thumbnails/1.jpg)
FUELParis - June 23, 2007
John Resig - Mozilla Corp.
![Page 2: Fuel - Firefox 3 (June '07)](https://reader035.vdocuments.site/reader035/viewer/2022081816/545c9befb1af9f3c0a8b47e9/html5/thumbnails/2.jpg)
What is FUEL?
• JavaScript API for Mozilla development
• Focus on solving most common problems
• Emphasis on Firefox Extension Dev
• Improve portability
• Targeting Web Developers
![Page 3: Fuel - Firefox 3 (June '07)](https://reader035.vdocuments.site/reader035/viewer/2022081816/545c9befb1af9f3c0a8b47e9/html5/thumbnails/3.jpg)
Implementation
• Written in pure JavaScript
• (Users can crack it open and see how it works.)
• Wrappers around XPCOM objects
![Page 4: Fuel - Firefox 3 (June '07)](https://reader035.vdocuments.site/reader035/viewer/2022081816/545c9befb1af9f3c0a8b47e9/html5/thumbnails/4.jpg)
Simplify Concepts
• Provide a consistent means of doing these:
• Events
• foo.events.addListener( “test”, fn );
• Iteration
• foo.all.forEach( fn );
• Add/Remove
• foo.add( obj ) / obj.remove()
![Page 5: Fuel - Firefox 3 (June '07)](https://reader035.vdocuments.site/reader035/viewer/2022081816/545c9befb1af9f3c0a8b47e9/html5/thumbnails/5.jpg)
FUEL 0.1
• Preferences, Events, Storage
• In Firefox 3.0a4
• API: http://wiki.mozilla.org/FUEL/0.1/API
![Page 6: Fuel - Firefox 3 (June '07)](https://reader035.vdocuments.site/reader035/viewer/2022081816/545c9befb1af9f3c0a8b47e9/html5/thumbnails/6.jpg)
Application Events
• Make sure the application is ready to be interacted with (all aspects are loaded):Application.events.addListener(“ready”, fn);
• Handle when a user exits the application:Application.events.addListener(“quit”, fn);
![Page 7: Fuel - Firefox 3 (June '07)](https://reader035.vdocuments.site/reader035/viewer/2022081816/545c9befb1af9f3c0a8b47e9/html5/thumbnails/7.jpg)
Preferences
• Coverage of the most common preference tasks.
• Get/Set Preferences:Application.prefs.getValue(“my.pref”, default);Application.prefs.setValue(“my.pref”, “value”);
• Extension Preferences:myExt.prefs.setValue(“autosave”, true);
![Page 8: Fuel - Firefox 3 (June '07)](https://reader035.vdocuments.site/reader035/viewer/2022081816/545c9befb1af9f3c0a8b47e9/html5/thumbnails/8.jpg)
Preferences (cont.)
• Get all preferences that have been modified by the user:Application.prefs.all.forEach(function(p){ if ( p.modified ) // do something});
![Page 9: Fuel - Firefox 3 (June '07)](https://reader035.vdocuments.site/reader035/viewer/2022081816/545c9befb1af9f3c0a8b47e9/html5/thumbnails/9.jpg)
Storage
• Temporary, runtime, data storage and retrieval.
• Application-wide storage:Application.storage.set(“data”, 4);
• Extension-level storage:myExt.storage.get(“data”, 0);
![Page 10: Fuel - Firefox 3 (June '07)](https://reader035.vdocuments.site/reader035/viewer/2022081816/545c9befb1af9f3c0a8b47e9/html5/thumbnails/10.jpg)
FUEL 0.2
• Window/Browser Tabs, Bookmarks
• Will be in Firefox 3.0a6 (under final review)
• API: http://wiki.mozilla.org/FUEL/0.2/API
![Page 11: Fuel - Firefox 3 (June '07)](https://reader035.vdocuments.site/reader035/viewer/2022081816/545c9befb1af9f3c0a8b47e9/html5/thumbnails/11.jpg)
Browser
• Get the current active browser window:Application.activeWindow
• Get the URL of the active tab:Application.activeWindow.activeTab.url
![Page 12: Fuel - Firefox 3 (June '07)](https://reader035.vdocuments.site/reader035/viewer/2022081816/545c9befb1af9f3c0a8b47e9/html5/thumbnails/12.jpg)
Browser (cont.)
• Open and activate a new tab: Application.activeWindow .open("http://google.com/").focus();
• Close all Google-related tabs: Application.activeWindow.tabs.forEach(function(tab){ if ( tab.url.match(/google/) ) tab.remove();});
![Page 13: Fuel - Firefox 3 (June '07)](https://reader035.vdocuments.site/reader035/viewer/2022081816/545c9befb1af9f3c0a8b47e9/html5/thumbnails/13.jpg)
Bookmarks
• Add a new bookmark: Application.bookmarks.add("Mozilla", "http://mozilla.org/");
• Remove all Google-related bookmarks: Application.bookmarks.all.forEach(function(cur){ if ( cur.url.match(/google.com/) ) cur.remove();});
![Page 14: Fuel - Firefox 3 (June '07)](https://reader035.vdocuments.site/reader035/viewer/2022081816/545c9befb1af9f3c0a8b47e9/html5/thumbnails/14.jpg)
Overview
• Application Events (0.1)
• Preferences (0.1)
• Storage (0.1)
• Bookmarks (0.2)
• Window / Browser Tabs (0.2)
![Page 15: Fuel - Firefox 3 (June '07)](https://reader035.vdocuments.site/reader035/viewer/2022081816/545c9befb1af9f3c0a8b47e9/html5/thumbnails/15.jpg)
More Info
• All about FUEL:http://wiki.mozilla.org/FUEL
• Test Suite:http://mxr.mozilla.org/seamonkey/source/browser/fuel/test/
• Contact:
• Mark Finkle ([email protected])
• John Resig ([email protected])