Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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();
import store from 'store2'
export default store.namespace('obs-tablet-remote')
import storage from "store2"
export const settingsStorage = storage.namespace("settings")
constructor(namespace) {
this.store = namespace ? store.namespace(namespace) : store;
this.session = this.store.session;
this.local = this.store.local;
}