quastore
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

QuaStore

Persistent browser-side state management module.

This package was developed primarily for the needs of QuaEngine, but it also supports the standalone usage.

Features

  • Presistent state management, APIs are inspired by vuex.

  • Multi-Slot Continuous Storage.

  • Provide composition APIs for convenience.

Usage

Step 1: Install this package from npm.

npm i quastore -S

Step 2: Create store.

QuaStoreManager.createStore({
  name: 'my-store',
  state: {
    value: 0,
  },
  mutations: {
    setValue(state, payload) {
      state.value = payload;
    },
  },
});

Step 3: Use store at anywhere.

import { useStore } from 'quastore';
const store = useStore('my-store');
// or
const store = QuaManager.getStore('my-store');
store.commit('setValue', 1);
console.log(store.state.value); // 1

If you don't want to use the manager, you can instantiate a standalone store.

const store = new QuaStore({
  state: {},
  mutations: {},
});

License

MIT

Package Sidebar

Install

npm i quastore

Weekly Downloads

2

Version

0.0.4

License

MIT

Unpacked Size

29.2 kB

Total Files

13

Last publish

Collaborators

  • backrunner