Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ryanve/cargo
Web storage API JavaScript module
https://github.com/ryanve/cargo
javascript javascript-library local-storage storage
Last synced: about 1 month ago
JSON representation
Web storage API JavaScript module
- Host: GitHub
- URL: https://github.com/ryanve/cargo
- Owner: ryanve
- Created: 2013-02-26T19:50:10.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-05-13T16:58:01.000Z (over 10 years ago)
- Last Synced: 2024-05-02T00:08:34.531Z (7 months ago)
- Topics: javascript, javascript-library, local-storage, storage
- Language: JavaScript
- Homepage: https://npm.im/cargo
- Size: 395 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cargo
#### HTML5 [web storage API](http://www.w3.org/TR/webstorage/) JavaScript module- Abstracts the native storage APIs into a simple intuitive interface
- Uses native `localStorage` and `sessionStorage` [where available](https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage#Browser_compatibility)
- Gracefully degrades to [temporary](#storage-duration) storage
- Works standalone or with build tools like [browserify](https://www.npmjs.org/package/browserify) or [ender](https://www.npmjs.org/package/ender)## API ([0.8](../../releases))
### `cargo.local()`
- `cargo.local(key?, value?)`
- `cargo.local()` get all
- `cargo.local(key)` get
- `cargo.local(key, value)` set
- `cargo.local(key, undefined)` remove
- `cargo.local.get(key)`
- `cargo.local.set(key, value)`
- `cargo.local.remove(key)`### `cargo.session()`
- `cargo.session(key?, value?)`
- `cargo.session()` get all
- `cargo.session(key)` get
- `cargo.session(key, value)` set
- `cargo.session(key, undefined)` remove
- `cargo.session.get(key)`
- `cargo.session.set(key, value)`
- `cargo.session.remove(key)`### `cargo.temp()`
- `cargo.temp(key?, value?)`
- `cargo.temp()` get all
- `cargo.temp(key)` get
- `cargo.temp(key, value)` set
- `cargo.temp(key, undefined)` remove
- `cargo.temp.get(key)`
- `cargo.temp.set(key, value)`
- `cargo.temp.remove(key)`## Storage duration
- [local](http://www.w3.org/TR/webstorage/#the-localstorage-attribute) storage stores for unlimited browser sessions
- [session](http://www.w3.org/TR/webstorage/#the-sessionstorage-attribute) storage stores for the current browser session
- temp storage stores until the user refreshes or closes the current page## Fund
Support this project by [tipping the developer](https://www.gittip.com/ryanve/) =)## License
MIT