All Projects β†’ seiyria β†’ ng2-storage

seiyria / ng2-storage

Licence: MIT license
A local and session storage wrapper for angular 2.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to ng2-storage

Brownies
🍫 Tastier cookies, local, session, and db storage in a tiny package. Includes subscribe() events for changes.
Stars: ✭ 2,386 (+16942.86%)
Mutual labels:  storage, localstorage, sessionstorage
Store
A better way to use localStorage and sessionStorage
Stars: ✭ 1,646 (+11657.14%)
Mutual labels:  storage, localstorage, sessionstorage
h5webstorage
Web Storage for Angular 2
Stars: ✭ 38 (+171.43%)
Mutual labels:  storage, localstorage, sessionstorage
React Storage Hooks
React hooks for persistent state
Stars: ✭ 146 (+942.86%)
Mutual labels:  storage, localstorage, sessionstorage
Angular Locker
πŸ—„οΈ A simple & configurable abstraction for local/session storage in angular js projects
Stars: ✭ 318 (+2171.43%)
Mutual labels:  storage, localstorage, sessionstorage
persistence
πŸ’Ύ Persistence provides a pretty easy API to handle Storage's implementations.
Stars: ✭ 18 (+28.57%)
Mutual labels:  storage, localstorage, sessionstorage
stoor
Storage wrapper with support for namespacing, timeouts and multi get/set and remove.
Stars: ✭ 26 (+85.71%)
Mutual labels:  storage, localstorage, sessionstorage
Proxy Storage
Provides an adapter for storage mechanisms (cookies, localStorage, sessionStorage, memoryStorage) and implements the Web Storage interface
Stars: ✭ 10 (-28.57%)
Mutual labels:  storage, localstorage, sessionstorage
Immortaldb
πŸ”© A relentless key-value store for the browser.
Stars: ✭ 2,962 (+21057.14%)
Mutual labels:  storage, localstorage, sessionstorage
vue-web-storage
Vue.js plugin for local storage and session storage (1.8 kb min+gz) πŸ’Ύ
Stars: ✭ 85 (+507.14%)
Mutual labels:  storage, localstorage, sessionstorage
Vue Ls
πŸ’₯ Vue plugin for work with local storage, session storage and memory storage from Vue context
Stars: ✭ 468 (+3242.86%)
Mutual labels:  storage, localstorage, sessionstorage
Recoil Persist
Package for recoil state manager to persist and rehydrate store
Stars: ✭ 66 (+371.43%)
Mutual labels:  storage, localstorage, sessionstorage
Vue Warehouse
A Cross-browser storage for Vue.js and Nuxt.js, with plugins support and easy extensibility based on Store.js.
Stars: ✭ 161 (+1050%)
Mutual labels:  storage, localstorage
Remotestorage.js
⬑ JavaScript client library for integrating remoteStorage in apps
Stars: ✭ 2,155 (+15292.86%)
Mutual labels:  storage, localstorage
Vuex Localstorage
Persist Vuex state with expires by localStorage or some else storage.
Stars: ✭ 129 (+821.43%)
Mutual labels:  storage, localstorage
Store.js
Cross-browser storage for all use cases, used across the web.
Stars: ✭ 13,656 (+97442.86%)
Mutual labels:  storage, localstorage
Flutter localstorage
πŸ“¦flutter localstorage for ios/android/desktop/web
Stars: ✭ 206 (+1371.43%)
Mutual labels:  storage, localstorage
mst-persist
Persist and hydrate MobX-state-tree stores (in < 100 LoC)
Stars: ✭ 75 (+435.71%)
Mutual labels:  localstorage, sessionstorage
cache-bucket
Light Cache for nodeJs and browserJs with TTL.
Stars: ✭ 14 (+0%)
Mutual labels:  localstorage, sessionstorage
Depot.js
πŸ“¦ depot.js is a storage library with a simple API
Stars: ✭ 247 (+1664.29%)
Mutual labels:  storage, localstorage

ng2-storage

A service wrapping local and session storage for ng2.

Install

npm i -s ng2-storage

Browser Support

This library makes heavy use of ES6 Proxy, meaning it only has support in the latest Edge, Chrome, Firefox, and Opera.

Usage

First, bootstrap the service globally:

import { StorageSettings } from 'ng2-storage';

bootstrap(App, [
  provide(StorageSettings, { useValue: { prefix: 'ng2-storage' } })
]);

Next, inject it into a component:

import { StorageService } from 'ng2-storage';

@Component({
  providers: [StorageService],
  template: `<button (click)="incrementStoredData()">click</button>`
})
export class MyComponent {

  static get parameters() {
    return [[StorageService]];
  }

  constructor(storage) {
    // you can also use storage.session for sessionStorage
    this.storage = storage.local;
  }

  incrementStoredData() {
    this.storage.data = this.storage.data || 0;
    this.storage.data++;
  }
}

Options

Name Default Description
prefix 'ng2-storage' The key prefix when assigning data to local or session storage.
serialize window.JSON Used when de/serializing data from the storage container. Both serialize and parse attributes must be specified and must be functions if you want custom ones.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].