extension-api-compilation
Version:
Cross browser extension api
28 lines (25 loc) • 900 B
JavaScript
import SyncStorage from './sync-storage';
export default class MozillaSyncStorage extends SyncStorage{
/**
* Set data to sync storage
* @param data {Object} An object which gives each key/value pair to update storage with
* @returns {Promise} Promise will be called with created data or failure
*/
set(data) {
return browser.storage.sync.set(data);
}
/**
* Get data from sync storage
* @param key {string|Array} A single key or list of keys to get the total usage for. An empty list will return 0. Pass in null to get the total usage of all of storage.
* @returns {Promise} The promise will associated data on success or error otherwise
*/
get(key) {
return browser.storage.sync.get(key);
}
/**
* Clear all data associated with current extension from sync storage
*/
clear() {
browser.storage.sync.clear();
}
}