browser-add-on-compatibility

0.1.3 • Public • Published

GitHub license Donate to liberapay

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.

Package Sidebar

Install

npm i browser-add-on-compatibility

Weekly Downloads

1

Version

0.1.3

License

MIT

Unpacked Size

17.5 kB

Total Files

12

Last publish

Collaborators

  • don.bidon