browser.runtime

nodejs bridge to support browser.runtime api

Stars
5

browser.runtime

browser.runtime implementation in nodejs.

See also Native Messaging.

Usage

npm install browser.runtime
const runtime = require('browser.runtime')
const port = runtime.connectNative(`${__dirname}/py_ping_pong`)

port.onMessage.addListener((response) => {
  t.equal(response, 'pong')
  port.disconnect()
})

port.postMessage('ping')

Transform streams

You can reuse low level transform streams to encode/decode messages:

const {NativeEncoder, NativeDecoder} = require('browser.runtime')

See tests.