Package Exports
- @kvs/storage-sync
- @kvs/storage-sync/lib/index.js
- @kvs/storage-sync/module/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@kvs/storage-sync) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@kvs/storage-sync
Storage-like for KVS.
You can inject Storage object like localStorage, sessionStorage to this storage.
@kvs/storage is async version, but @kvs/storage-sync is sync version.
Feature
- Synchronize version [@kvs/storage]
- Support
[Symbol.iterator]instead of[Symbol.asyncIterator] - Injectable
localStorageorsessionStorage
Install
Install with npm:
npm install @kvs/storage-syncUsage
import assert from "assert";
import { kvsStorageSync } from "@kvs/storage";
(() => {
type StorageSchema = {
a1: string;
b2: number;
c3: boolean;
};
const storage = kvsStorageSync<StorageSchema>({
name: "test",
version: 1,
storage: localStorage
});
storage.set("a1", "string");
storage.set("b2", 42);
storage.set("c3", false);
const a1 = storage.get("a1");
const b2 = storage.get("b2");
const c3 = storage.get("c3");
assert.strictEqual(a1, "string");
assert.strictEqual(b2, 42);
assert.strictEqual(c3, false);
})();Changelog
See Releases page.
Running tests
Install devDependencies and Run npm test:
npm testContributing
Pull requests and stars are always welcome.
For bugs and feature requests, please create an issue.
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request :D
Author
License
MIT © azu