1.0.4 • Published 6 years ago

browser.runtime v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

browser.runtime

Build Status

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.