Skip to content

flashlizi/node-chrome-bridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Chrome Extension/App Bridge for NodeJS

This NodeJS library helps you to communicate with chrome extension/app.

Usage

var chromeBridge = require('chrome-bridge');

//send a message to chrome
chromeBridge.sendMessage({text:'hello chrome!'});

//listen message from chrome
chromeBridge.on('message', function(msg){
    console.log('received from chrome:', msg);
});

APIs

  • sendMessage(msgObject) - Send a message to chrome extension/app. The msgObject must be a JSON object.
  • on('message', handler) - Listen messages from chrome extension/app.

Demo

There is a simple demo Web Terminal, you can check it in the demo folder.

  • If you don't have NodeJS installed, install it first.
  • Install native host. open a terminal, cd to the /demo/host directory, run command sh install_host.sh.
  • Open a tab with chrome://extensions/ in chrome, load the extension with /demo directory, you will see a cube popup icon on the right of navigation bar.
  • Click it and open a page, play any commands on it, such as node -v.

Here is the screenshot:

效果演示图

About

A Chrome Extension/App Bridge for NodeJS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published