1.2.1 • Published 5 years ago
bitconnect-framework v1.2.1
bitconnect
Simple interface between the console and program. (the name is intentional)
Usage
const bitconnect = require('bitconnect-framework');
bitconnect.prefix("$ "); // set prefix to watever (default '> ')
// # warning, do not use console.log, instead use log function given # //
bitconnect.on('bepis', (log) => {
log("ayy");
})
bitconnect.on('conke', (log) => {
log("nooo");
bitconnect.prompt('change? ', function (answer, log) { // ask use to change
log(answer); // log their input
log('better be yes...');
})
})
bitconnect.on('stop', (log) => {
bitconnect.pause();
// here no input will be received
// safe to use console.log
setTimeout(function () {
bitconnect.resume(); // use will be re-prompted
}, 5000);
})
bitconnect.onError((line, log) => { // if bitconnect cant find a matching handler
log(`Unkown: ${line}`); // log watever
})
bitconnect.ready(); // call to start up bitconnect