@vk-x/inject
v2.0.0
Published
Inject a script into a page from a browser extension
Downloads
8
Readme
inject
For use inside Chrome extensions. Injects scripts into the page context.
inject = require("@vk-x/inject")
// File name will be resolved with chrome.extension.getURL()
inject("path/to/file.js")
// Pass true as the second argument to inject the string itself as code.
inject("console.log('Inline code')", true)
// Functions are automatically stringified and wrapped into an IIFE.
inject(function() { console.log("I'm injected!") })