fuel - firefox 3 (june '07)

15
FUEL Paris - June 23, 2007 John Resig - Mozilla Corp.

Upload: jeresig

Post on 07-Nov-2014

11.797 views

Category:

Technology


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Fuel - Firefox 3 (June '07)

FUELParis - June 23, 2007

John Resig - Mozilla Corp.

Page 2: Fuel - Firefox 3 (June '07)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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])