Labs/Jetpack/Reboot/JEP/105: Difference between revisions
Dandonkulous (talk | contribs) No edit summary |
|||
Line 9: | Line 9: | ||
=== Proposal === | === Proposal === | ||
This JEP describes an API for handling the life-cycle of Jetpacks. In particular, it gives a Jetpack methods for registering event handlers for various install and uninstall states. | |||
In addition to the event handlers, it provides a more declarative format. | |||
==== Events ==== | |||
All methods of an add-on introspecting and interacting with its environmental metas using the Jetpack API live in the "me" module. | |||
The event handlers can be used as follows: | |||
<pre class="brush:js;"> | |||
me = require("me"); | |||
me.onFirstRun( function ) | |||
me.onInstall( function ) | |||
me.onUninstall( function ) | |||
</pre> | |||
The <code>me.onFirstRun</code> gets called on the first run of an extension. If an extension is uninstalled and reinstalled (and the original data wasn't removed via a purge event) then the callback(s) passed to <code>onFirstRun</code> aren't called. | |||
The rest of the event handlers should be self-explanatory. | |||
Because Jetpacks are easily installed and uninstalled, the concepts of disabling/enabling an extension have been removed. | |||
==== Declarative ==== | |||
The first-run experience is coded inside of <code>manifest</code>, the feature's manifest, which is (not un-coincidentally) where the settings are placed. | |||
<pre class="brush:js;"> | |||
var manifest = { | |||
firstRunPage: stringOrXml, | |||
uninstallPage: stringOrXml | |||
} | |||
</pre> | |||
=== Difficulty === | |||
Rating: '''Easy''' | |||
=== Key Issues === | === Key Issues === |
Revision as of 07:37, 5 February 2010
JEP 105 - Life-cycle
- Champion: Aza Raskin - aza@mozilla.com
- Status: Accepted/In-Queue
- Bug Ticket:
- Type: API
- Difficulty: 4
Proposal
This JEP describes an API for handling the life-cycle of Jetpacks. In particular, it gives a Jetpack methods for registering event handlers for various install and uninstall states.
In addition to the event handlers, it provides a more declarative format.
Events
All methods of an add-on introspecting and interacting with its environmental metas using the Jetpack API live in the "me" module.
The event handlers can be used as follows:
me = require("me"); me.onFirstRun( function ) me.onInstall( function ) me.onUninstall( function )
The me.onFirstRun
gets called on the first run of an extension. If an extension is uninstalled and reinstalled (and the original data wasn't removed via a purge event) then the callback(s) passed to onFirstRun
aren't called.
The rest of the event handlers should be self-explanatory.
Because Jetpacks are easily installed and uninstalled, the concepts of disabling/enabling an extension have been removed.
Declarative
The first-run experience is coded inside of manifest
, the feature's manifest, which is (not un-coincidentally) where the settings are placed.
var manifest = { firstRunPage: stringOrXml, uninstallPage: stringOrXml }
Difficulty
Rating: Easy
Key Issues
Dependencies & Requirements
- Dependent on JEP 106
Internal Methods
- What methods, mechanisms, or resources does this provide internally within the Jetpack platform code.
API Methods
- What are the pretty API wrapped methods externally exposed to Jetpack developers?