Labs/Jetpack/JEP/11: Difference between revisions
(Origination) |
(added more stuff) |
||
| Line 13: | Line 13: | ||
=== Introduction and Rationale === | === Introduction and Rationale === | ||
This JEP describes a simple mechanism through which Jetpacks can persistently store blobs of JSON data. | This JEP describes a simple mechanism through which Jetpacks can persistently store JS primitives and blobs of JSON data. | ||
As part of this proposal is adding a <code>jetpack.storage</code> namespace. | As part of this proposal is adding a <code>jetpack.storage</code> namespace. | ||
| Line 19: | Line 19: | ||
=== Proposal === | === Proposal === | ||
Persistent storage will live at <code>jetpack.storage. | Persistent storage will live at <code>jetpack.storage.simple</code>. The <code>jetpack.storage</code> will provide access to any other available storage systems, such as sqlite. The current <code>jetpack.sessionStorage</code> object, which allows arbitrary JS objects (they need not be JSON-able) to be stored between reloads of a Jetpack within the same Firefox session, will be renamed to <code>jetpack.storage.session</code>. | ||
==== | ==== Storing Values ==== | ||
<pre class="brush:js;toolbar:false;"> | <pre class="brush:js;toolbar:false;"> | ||
jetpack.storage. | jetpack.storage.simple.set(key, value) | ||
</pre> | </pre> | ||
| Line 36: | Line 36: | ||
This function has no return value. | This function has no return value. | ||
==== Removing Values ==== | |||
<pre class="brush:js;toolbar:false;"> | <pre class="brush:js;toolbar:false;"> | ||
jetpack.storage. | jetpack.storage.simple.remove(key) | ||
</pre> | </pre> | ||
| Line 50: | Line 52: | ||
This function has no return value. | This function has no return value. | ||
Revision as of 00:19, 28 May 2009
JEP 11 - Simple Persistent Storage
- Author: Atul Varma <atul at mozilla dot com>
- Champion: Atul Varma <atul at mozilla dot com>
- Status: Draft
- Type: API Track
- Created: 27 May 2009
- Reference Implementation: None
- JEP Index
Introduction and Rationale
This JEP describes a simple mechanism through which Jetpacks can persistently store JS primitives and blobs of JSON data.
As part of this proposal is adding a jetpack.storage namespace.
Proposal
Persistent storage will live at jetpack.storage.simple. The jetpack.storage will provide access to any other available storage systems, such as sqlite. The current jetpack.sessionStorage object, which allows arbitrary JS objects (they need not be JSON-able) to be stored between reloads of a Jetpack within the same Firefox session, will be renamed to jetpack.storage.session.
Storing Values
jetpack.storage.simple.set(key, value)
Arguments
key: A string uniquely identifying the data to be placed in persistent storage.
value: A JS primitive or JSON-able JS object that represents the data to be stored in persistent storage. If some other data with the given key is already being stored, it is overwritten by value.
Return value
This function has no return value.
Removing Values
jetpack.storage.simple.remove(key)
Removes the key and its associated data from persistent storage.
Arguments
key: The string uniquely identifying the data to be removed from persistent storage.
Return value
This function has no return value.