https://github.com/sergi/promised-storage
Store persistent data in the browser asynchronously with promises
https://github.com/sergi/promised-storage
Last synced: over 1 year ago
JSON representation
Store persistent data in the browser asynchronously with promises
- Host: GitHub
- URL: https://github.com/sergi/promised-storage
- Owner: sergi
- License: apache-2.0
- Created: 2014-01-15T22:40:47.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-01-19T13:14:08.000Z (over 12 years ago)
- Last Synced: 2025-03-26T08:13:53.372Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 137 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Promised Storage is basically a port of
[Mozilla's async_storage.js](https://github.com/mozilla-b2g/gaia/blob/master/shared/js/async_storage.js) to Promises.
With Promised Storage you can store data in a persistent Key/Value database in the browser
similarly to how you do it with [localStorage](http://diveintohtml5.info/storage.html)
but in a non-blocking way (localStorage methods block the main thread). It does so
by leveraging the more powerful [IndexedDB](https://developer.mozilla.org/en/docs/IndexedDB)
database behind the scenes.
Usage
-----
For example:
```javascript
var p = promisedStorage.setItem("solution", 42);
p.then(function() {
return promisedStorage.getItem("solution")
}).then(function(value) {
console.log("The Stored value is", value); // 42
});
```
License
-------
Apache 2.0