1.0.6 • Published 2 years ago
simple-nativemessage v1.0.6
simple-nativemessage
a simple library to communicate with browser extensions using the native message protocol designed to be quick and easily understood
still a work in progress, expect changes
see github repository for additional details and a simple helloworld chrome extension
note:
stdin and stdout are used for communicating with the browser, therefore stderr must be piped to a file
nmhost provides a debug function, which will write to stderr
var nmhost = require('simple-nativemessage');
nmhost.rec = rec;
var debug = nmhost.debug;
function rec(json){
debug('rec',JSON.stringify(json,null,4));
switch(json.type){
case 'hello' : nmhost.send('world'); break;
}//switch
}//rec