Closed
Bug 503466
Opened 15 years ago
Closed 15 years ago
Make simple storage synchronous
Categories
(Mozilla Labs :: Jetpack Prototype, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: adw, Assigned: adw)
Details
Attachments
(1 file)
30.60 KB,
patch
|
Details | Diff | Splinter Review |
Let's do it. Nobody's happy with async for what should be a simple API. I talked with mconnor about it last night. We'll provide avenues for Jetpack authors who need more heavy-duty storage solutions. The async API is deprecated. Here's how it works, quoting from source comments: ----- Simple storage is really simple. jetpack.storage.simple is a single, persistent JavaScript object available to each Jetpack feature. For the most part this object is like any other JavaScript object, and a feature can set whatever properties it wants on it. To manipulate its persistent data, a feature therefore need only use the various standard JavaScript functions and operators. Each feature gets its own private storage. To write the object to disk, you must call jetpack.storage.simple.sync(). To force the object to reload its data from disk, call jetpack.storage.simple.open(), although the data comes loaded automatically so you shouldn't have to worry about it. Here's an example: var myStorage = jetpack.storage.simple; myStorage.fribblefrops = [1, 3, 3, 7]; myStorage.heimelfarbs = { bar: "baz" }; myStorage.sync(); And then later: var myStorage = jetpack.storage.simple; myStorage.fribblefrops.forEach(function (elt) console.log(elt)); var bar = myStorage.heimelfarbs.bar; ----- We should investigate using Atul's catch-alls to obviate the need to manually sync the store. Alternatively we could sync on a timer and on unload.
Assignee | ||
Comment 1•15 years ago
|
||
Now to figure out how to push to the repo...
Assignee | ||
Comment 2•15 years ago
|
||
http://hg.mozilla.org/labs/jetpack/rev/af0389adbb5d
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•