Package Exports
- @wranggle/storage-chrome-adapter
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@wranggle/storage-chrome-adapter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ChromeAdapter
The ChromeAdapter lets WranggleStorage use the Google Chrome Storage API for its underlying persistent store in a browser extension.
Constructing WranggleStorage with ChromeAdapter
You can apply this adapter using the chrome or chromeSynchronized shortcuts when constructing your WranggleStorage instance.
chrome specifies the chrome.storage.local API, and chromeSynchronized specifies the chrome.storage.sync API.
Eg:
const store = new WranggleStorage({ chrome: true }); // or new WranggleStorage('chrome')Installing From Individual Packages
For a web page, it is easiest to use the @wranggle/storage-web bundle.
Or you can add/install individual packages:
Add the @wranggle/storage-core and @wranggle/storage-chrome-adapter packages to your project:
# From the command line using yarn: yarn add @wranggle/storage-core @wranggle/storage-chrome-adapter # or with npm: npm install @wranggle/storage-core @wranggle/storage-chrome-adapter
In your JavaScript, import or require the packages:
import WranggleStorage from '@wranggle/storage-core'; import ChromeAdapter from '@wranggle/storage-chrome-adapter' // or: const WranggleStorage = require('@wranggle/storage-core'); const ChromeAdapter = require('@wranggle/storage-chrome-adapter')
Instantiate your store:
const store = new WranggleStorage({ chrome: true });
Or do so without the construction shortcut:
const store = new WranggleStorage({ persist: new ChromeAdapter({ location: 'local' }));