Skip to content

eliihen/localforage-webExtensionStorage-driver

Repository files navigation

LocalForage WebExtension chrome.storage driver

Build Status npm version

This project adds a webextension driver to localForage

Usage

Using a module bundler:

import localforage from 'localforage';
import syncDriver from 'localforage-webextensionstorage-driver/sync';

localforage
  .defineDriver(syncDriver)
  .then(() => localforage.setDriver('webExtensionSyncStorage'));
// When this promise resolves, a new driver should be set

Using plain javascript:

This project was not originally intended to be used without a module bundler like webpack, so the result will be a larger file if you do it this way. However, if you wish to do so, you can find a browser compatible file on the releases page.

There is an example of how use this here.

Install

$ npm install --save localforage-webextensionstorage-driver

API

Import Path Driver Name (setDriver) Description
localforage-webextensionstorage-driver/local webExtensionLocalStorage chrome/browser.local storage area
localforage-webextensionstorage-driver/sync webExtensionSyncStorage chrome/browser.sync storage area