bitconnect-framework

Simple interface between the console and program. (the name is intetional)

Usage no npm install needed!

<script type="module">
  import bitconnectFramework from 'https://cdn.skypack.dev/bitconnect-framework';
</script>

README

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