@skazska/inform

0.0.10 • Public • Published

Build Status

inform

Provide a tool to prepare and print-out information on tasks progress

npm run demo - to see a demo

usage:

const Inform = require('@skazska/inform');
const inform = new Inform('main');
const group = inform.mainGroup;
const informer = group.addInformer(new Promise((resolve, reject ) => setTimeout(() => {reject(new Error('done'))}, 100)), {
    failText: 'damn',
    pendingText: 'waiting',
    inProcessText: 'doing',
    doneText: 'did',
    text: 'it'
});

const promise1 = new Promise((resolve, reject ) => setTimeout(() => {reject(new Error('done'))}, 1000));
const promise2 = new Promise((resolve, reject ) => {
    promise1.catch(() => {
        setTimeout(() => { resolve('done')}, 2000);
    });
});

group.addInformer(promise1, {
    failText: 'damn',
    pendingText: 'waiting',
    inProcessText: 'doing',
    doneText: 'did',
    text: 'it'
});
const informer2 = group.addInformer(null, {
    failText: 'damn',
    pendingText: 'waiting',
    inProcessText: 'doing',
    doneText: 'did',
    text: 'it'
});

setTimeout(() => {
    informer2.task = promise2;
}, 500);

Package Sidebar

Install

npm i @skazska/inform

Weekly Downloads

2

Version

0.0.10

License

Apache-2.0

Unpacked Size

71.7 kB

Total Files

13

Last publish

Collaborators

  • skazska