Labs/Jetpack/API: Difference between revisions

From MozillaWiki
< Labs‎ | Jetpack
Jump to navigation Jump to search
Line 1: Line 1:
JetPack is a project to explore new and innovative approaches to extensibility of the browser.
= JetPack API Reference =
= JetPack API Reference =


JetPack is a project to explore new and innovative approaches to extensibility of the browser.
'''WARNING''': This reference is extremely volatile and will change.
 


'''Logger'''
'''Logger'''
Used to output debugging information, it appears in the Javascript Error Console. You can access it from the Tools menu.
Used to output debugging information, it appears in the Javascript Error Console. You can access it from the Tools menu.
* <code>log( message )</code> or <code>log({message: string})</code>. Shows a log message in the Error Console.
* <code>log( message )</code>. Shows a log message in the Error Console.
* <code>debug( message )</code> or <code>debug({message: string})</code>. Shows a debug message in the Error Console.
* <code>debug( message )</code>. Shows a debug message in the Error Console.
* <code>info( message )</code> or <code>info({message: string})</code>. Shows an info message in the Error Console.
* <code>info( message )</code>. Shows an info message in the Error Console.
* <code>warn( message )</code> or <code>warn({message: string})</code>. Shows a warning in the Error Console.
* <code>warn( message )</code>. Shows a warning in the Error Console.
* <code>error( message )</code> or <code>error({message: string})</code>. Shows an error message in the Error Console.
* <code>error( message )</code>. Shows an error message in the Error Console.
 
'''Storage'''
Persistent storage for your feature. The storage is sandboxed per feature, so data stored by one JetPack feature cannot be accessed by another JetPack feature.
* <code>has(name)</code>. Checks whether a JetPack feature has stored a value.
* <code>get(name)</code>. Returns the value of a stored object by name.
* <code>set({name:string, value:string}). Sets the value of an object by name. Use .toSource() to store Javascript objects. In the future, serialization will be performed automatically.
 
'''UI'''
Interacting with the user interface of the browser is done through this component.

Revision as of 08:10, 27 April 2009

JetPack is a project to explore new and innovative approaches to extensibility of the browser.

JetPack API Reference

WARNING: This reference is extremely volatile and will change.

Logger Used to output debugging information, it appears in the Javascript Error Console. You can access it from the Tools menu.

  • log( message ). Shows a log message in the Error Console.
  • debug( message ). Shows a debug message in the Error Console.
  • info( message ). Shows an info message in the Error Console.
  • warn( message ). Shows a warning in the Error Console.
  • error( message ). Shows an error message in the Error Console.

Storage Persistent storage for your feature. The storage is sandboxed per feature, so data stored by one JetPack feature cannot be accessed by another JetPack feature.

  • has(name). Checks whether a JetPack feature has stored a value.
  • get(name). Returns the value of a stored object by name.
  • set({name:string, value:string}). Sets the value of an object by name. Use .toSource() to store Javascript objects. In the future, serialization will be performed automatically.

UI Interacting with the user interface of the browser is done through this component.