Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not sure how to use browser.storage.sync with localForage driver #266

Open
mrleblanc101 opened this issue Apr 4, 2023 · 2 comments
Open

Comments

@mrleblanc101
Copy link

mrleblanc101 commented Apr 4, 2023

I use esphen/localforage-webExtensionStorage-driver to add webextension storage support to localForage, but I'm not sure how to make this work with vuex-persist.

import Vuex from 'vuex';
import VuexPersistence from 'vuex-persist';
import localforage from 'localforage';
import syncDriver from 'localforage-webextensionstorage-driver/sync';

localforage.defineDriver(syncDriver).then(() => localforage.setDriver('webExtensionSyncStorage'));

const extensionStorage = new VuexPersistence({
    storage: localforage,
    asyncStorage: true,
});

const store = new Vuex.Store({
    state: {
        hello: 'world',
    },
    mutations: {},
    actions: {},
    plugins: [extensionStorage.plugin],
});

export default store;
@mrleblanc101 mrleblanc101 changed the title Not sure how to use localForage (for chrome.storage.sync) Not sure how to use chrome.storage.sync with localForage driver Apr 4, 2023
@mrleblanc101 mrleblanc101 changed the title Not sure how to use chrome.storage.sync with localForage driver Not sure how to use browser.storage.sync with localForage driver Apr 4, 2023
@nsano-rururu
Copy link

localforage-webExtensionStorage-driver seems stuck with error

@nsano-rururu
Copy link

Writing as follows seems to work.

localforage.defineDriver(syncDriver).then(() => localforage.setDriver(localforage.INDEXEDDB));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants