Aqa-Ib / content-scripts-register-polyfill

WebExtensions: Polyfill for browser.contentScripts.register() for Chrome.

Home Page:https://npm.im/content-scripts-register-polyfill

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

content-scripts-register-polyfill

WebExtensions: Polyfill for browser.contentScripts.register() for Chrome.

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 content-scripts-register-polyfill
import 'content-scripts-register-polyfill';
require('content-scripts-register-polyfill');

Usage

Include the script via manifest.json, then refer to the original contentScripts.register() documentation.

const registeredScript = await chrome.contentScripts.register({
	js: [{
		file: 'myfile.js'
	}],
	matches: [
		'https://google.com/*'
	]
});

Additionally, if you're using webextension-polyfill, you can also use it with the original browser.* name: browser.contentsScripts.register()

const registeredScript = await browser.contentScripts.register({
	js: [{
		file: 'myfile.js'
	}],
	matches: [
		'https://google.com/*'
	]
});

Related

License

MIT © Federico Brigante

About

WebExtensions: Polyfill for browser.contentScripts.register() for Chrome.

https://npm.im/content-scripts-register-polyfill

License:MIT License


Languages

Language:TypeScript 100.0%