JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8465
  • Score
    100M100P100Q138816F
  • License MIT

Super-lightweight Promised wrapper around `chrome.*` API to be used in modules. Prefer `webextension-polyfill` if you’re using it directly in an extension.

Package Exports

  • webext-polyfill-kinda
  • webext-polyfill-kinda/index.js

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 (webext-polyfill-kinda) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

webext-polyfill-kinda

Super-lightweight Promised wrapper around chrome.* APIs to be used in modules.

✅ Use this module when publishing your own micro-modules. This avoids having to import webextension-polyfill as a sub-dependency.

❌ Do not use this module if you need promised APIs directly in your extension. webextension-polyfill is much safer.

⚠️ This package isn't completely safe to use because it blindly wraps the chrome.* APIs whether it supports them or not.

Please test your module in every browser before assuming it works, or prefer webextension-polyfill.

Install

npm install webext-polyfill-kinda

Usage

import chromeP from 'webext-polyfill-kinda';

(async () => {
    // Cases where the API works
    const currentTab = await chromeP.tabs.getCurrent();
    const options = await chromeP.storage.local.get('options');

    // Do not use `chromeP` when dealing with listeners, it doesn't make sense. Use the native `chrome.*` API
    chrome.tabs.onUpdated.addListener(listener);
})();

TypeScript Usage

chromeP will reuse the global chrome type if it exists. The suggested solution is to also install this, the types will be automatically available.

npm install @types/chrome --save-dev

License

MIT © Federico Brigante