chrx

CommonJS modules for developing Chrome Extensions

Usage no npm install needed!

<script type="module">
  import chrx from 'https://cdn.skypack.dev/chrx';
</script>

README

chrx

chrx is a collection of CommonJS modules for developing Chrome Extensions. The chrome.* APIs provided in Chrome are powerful, but their complexity can make simple tasks rather difficult. This project is an attempt to collect some common abstractions and distribute them via npm.

API

tabs

window

tabs

getActive([options][, callback])

Gets the active tab in the active window.

chrx.tabs.getActive(function(err, tab){})

options

  • protocol

executeScripts(options[, callback])

Executes content scripts in a tab.

chrx.tabs.executeScripts({
    tab: tab,
    scripts: ['underscore.js', 'jquery.js']
}, function(err, tab){})

options

  • tab (required)
  • scripts (required)
  • runAt

executeScriptsInActive(options[, callback])

Executes content scripts in the active tab.

chrx.tabs.executeScriptsInActive({
    scripts: ['underscore.js', 'jquery.js']
}, function(err, tab){})

options

  • scripts (required)
  • runAt

getActive([callback])

Gets the active window.

chrx.window.getActive(function(err, win){})

License

MIT License, see LICENSE for details.