Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/onehilltech/ember-cli-storage
EmberJS add-on for accessing local and session storage in a browser
https://github.com/onehilltech/ember-cli-storage
ember ember-addon local session storage
Last synced: about 2 months ago
JSON representation
EmberJS add-on for accessing local and session storage in a browser
- Host: GitHub
- URL: https://github.com/onehilltech/ember-cli-storage
- Owner: onehilltech
- License: apache-2.0
- Created: 2017-08-08T11:45:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-03-24T20:35:18.000Z (almost 4 years ago)
- Last Synced: 2024-11-20T19:02:34.150Z (about 2 months ago)
- Topics: ember, ember-addon, local, session, storage
- Language: JavaScript
- Homepage:
- Size: 638 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ember-cli-storage
A simple and easy way to interact with local and session storage.
Compatibility
------------------------------------------------------------------------------* Ember.js v3.12 or above
* Ember CLI v2.13 or above
* Node.js v10 or aboveInstallation
------------------------------------------------------------------------------```
ember install @onehilltech/ember-cli-storage
```Usage
------------------------------------------------------------------------------The add-on uses decorators to set/get items to/from local or session storage. For
local storage, use `@local`. For session storage, use `@session`. The parameters
for either decorator is the same.```javascript
class MyClass {
@session
mySessionProperty;
@local
myLocalProperty;
/////////
// advanced usage
/////////// store the value under 'aDifferentName'
@local ('aDifferentName') name;
@local ({name: 'aDifferentName'}) anotherName;// use the serialize/deserialize method to customize storing/retrieving
@local ({serialize: JSON.stringify, deserialize: JSON.parse}) object;
}
```Happy Coding!
Contributing
------------------------------------------------------------------------------See the [Contributing](CONTRIBUTING.md) guide for details.
License
------------------------------------------------------------------------------This project is licensed under the [Apache 2.0](LICENSE.md).