1.0.3 • Published 4 years ago

@im4all/store v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

Demo

Install

npm i @im4all/store --save

Usage

Register store

import { Event, Storage, Store } from '@im4all/store';

// Make sure this line get called only once
// if you are using angular then call inside app.component.ts ngOnInit
Store.register({ storage: Storage, event: Event });

Watch store change

Store.onChange((data, updatedItem) => {
    console.log(data, updatedItem);
});

Add or update an item inside store

Store.setItem('name', 'something');

Update multiple items at once

Store.setItems([
    { key: 'b', value: 2 },
    { key: 'c', value: 3 }
]);

Get all item from store

Store.all();

Clear all data from store

Store.flush();
1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago