🚀 a threaded progression logger
The purpose of onwithit
is to be able to make logging to the stdout threaded. The current logging approach is dependent on the main thread which will make updating animations or text being displayed to the user seem stalled. The simplest of all animations is a loading or spinner animation that the user could encounter during a long running task.
npm install onwithit --save
function wait(time) {
var now = Date.now();
while(Date.now() < now + time){}
}
const OnWithIt = require('onwithit');
const program = new OnWithIt("Building something cool").start();
wait(500);
program.text = "Building phase 1";
wait(500);
program.info("Phase 1 built");
program.text = "Building phase 2";
wait(500);
program.success("Phase 2 built");
program.stop();
The interface for onwithit
has taken cues from the greats, ora is a great library and has been used in a ton of my projects.