A real time storage library based on localforage and rxjs.
via npm:
npm install rt-storage
via yarn:
yarn add rt-storage
With Webpack:
import RTStorage from 'rt-storage';
const storage = new RTStorage({ name: 'test-db' });
storage.subscribe((event) => {
console.dir(event)
});
With CDN:
<script src="https://unpkg.com/localforage@1.7.3/dist/localforage.js"></script>
<script src="https://unpkg.com/rxjs@6.4.0/bundles/rxjs.umd.min.js"></script>
<script src="https://wzrd.in/standalone/uuid%2Fv4@latest"></script>
<script src="https://unpkg.com/rt-storage@0.0.1/build/index.js"></script>
<script>
var storage = new RTStorage({ name: 'test-db' });
storage.subscribe((event) => {
console.dir(event)
});
</script>
Get data from storage:
storage.getItem(storageKey)
Return promise
Set data into storage:
storage.setItem(storageKey, data)
Return promise.
Subscribe storage data changed event:
const subscription = storage.subscribe((event) => console.dir(event));
// subscription.unsubscribe
storage.subscribe('storageKey', (data) => console.dir(data));