How to use the store2.namespace function in store2

To help you get started, we’ve selected a few store2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github learningequality / studio / contentcuration / contentcuration / frontend / shared / vuex / persistFactory.js View on Github external
export default function persistFactory(ns, persistMutations) {
  const storage = Storage.namespace(ns);

  return function(store) {
    // Reusable so we can trigger now and attach to focus event
    const load = () => {
      persistMutations.forEach(mutation => {
        if (storage.has(mutation)) {
          const payloads = /^ADD/.test(mutation) ? storage(mutation) : [storage(mutation)];

          payloads.forEach(payload => store.commit(mutation, payload));
        }
      });
    };

    window.addEventListener('focus', load);
    load();
github t2t2 / obs-tablet-remote / src / javascripts / storage.js View on Github external
import store from 'store2'

export default store.namespace('obs-tablet-remote')
github ConanXie / new-tab / src / utils / storage.ts View on Github external
import storage from "store2"

export const settingsStorage = storage.namespace("settings")
github LANIF-UI / cmn-utils / src / store / store.js View on Github external
constructor(namespace) {
    this.store = namespace ? store.namespace(namespace) : store;
    this.session = this.store.session;
    this.local = this.store.local;
  }

store2

Better localStorage

MIT
Latest version published 9 months ago

Package Health Score

77 / 100
Full package analysis