1.0.1 • Published 4 years ago

webext-permissions-events-polyfill v1.0.1

Weekly downloads
51
License
MIT
Repository
github
Last release
4 years ago

webext-permissions-events-polyfill

WebExtensions: Polyfill for permissions.onAdded and permissions.onRemoved events for Firefox.

Travis build status npm version

Optional permissions can be added and removed by both Chrome and Firefox, but Firefox doesn't yet support Permission Events: https://bugzilla.mozilla.org/show_bug.cgi?id=1444294

This polyfill will add those two events to Firefox.

Install

You can just download the standalone bundle (it might take a minute to download) and include the file in your manifest.json, or:

npm install webext-permissions-events-polyfill
import 'webext-permissions-events-polyfill';
require('webext-permissions-events-polyfill');

Usage

Include the polyfill in manifest.json (except in content scripts) and then refer to the original Permissions Events documentation.

chrome.permissions.onAdded.addListener(permissions => {
	console.log('New permissions');
	console.log(permissions.origins);
	console.log(permissions.permissions);
});

chrome.permissions.onRemoved.addListener(permissions => {
	console.log('Permissions that have been removed');
	console.log(permissions.origins);
	console.log(permissions.permissions);
});

Related

Permissions

Others

License

MIT © Federico Brigante