Wondering what’s next for npm?Check out our public roadmap! »

    content-scripts-register-polyfill
    TypeScript icon, indicating that this package has built-in type declarations

    2.1.0 • Public • Published

    content-scripts-register-polyfill

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

    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';

    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

    Install

    npm i content-scripts-register-polyfill

    DownloadsWeekly Downloads

    313

    Version

    2.1.0

    License

    MIT

    Unpacked Size

    8.26 kB

    Total Files

    6

    Last publish

    Collaborators

    • avatar