browser-add-on-compatibility
v0.1.3
Published
Partial compatibility for Mozilla Firefox & Google Chrome add-ons
Downloads
12
Maintainers
Readme
Partial compatibility for Mozilla Firefox & Google Chrome add-ons
All files contain code:
if ("undefined" !== typeof(chrome)) {
var browser = chrome;
}
Implements returning Promise instead of passing callback in Google Chrome extensions context for following methods:
- browser.runtime (Firefox, Chrome):
- browser.runtime.sendMessage();
- browser.tabs (tabs permission required, Firefox, Chrome):
- browser.tabs.create();
- browser.tabs.query();
- browser.tabs.sendMessage();
- browser.tabs.update();
- browser.storage.<storageArea> (storage permission required, Firefox, Chrome):
- browser.storage.<storageArea>.clear();
- browser.storage.<storageArea>.get();
- browser.storage.<storageArea>.getBytesInUse();
- browser.storage.<storageArea>.remove();
- browser.storage.<storageArea>.set().
Usage
npm i browser-add-on-compatibility
- browser.runtime: "node_modules/browser-add-on-compatibility/src/browser/runtime.js";
- browser.tabs: "node_modules/browser-add-on-compatibility/src/browser/tabs.js";
- browser.storage:
- local: "node_modules/browser-add-on-compatibility/src/browser/storage/local.js";
- managed: "node_modules/browser-add-on-compatibility/src/browser/storage/managed.js";
- sync: "node_modules/browser-add-on-compatibility/src/browser/storage/sync.js".
Donate
Yandex.Money, Visa, MasterCard, Maestro or click to the "receives" badge.