0.6.0 • Published 2 years ago

wait-ready v0.6.0

Weekly downloads
29
License
MIT
Repository
github
Last release
2 years ago

wait-ready npm npm downloads Node.js CI

a promise based utility for perform actions after async tasks finished

Install

npm i --save wait-ready

Usage Example

// ES6 import
import { wait, withReady } from 'wait-ready'
// CommonJS require
const { wait, withReady } = require('wait-ready');

const { afterReady, setReady } = wait();
// wait for the ready status to perform some actions
afterReady().then(() => {
    // pending actions ...
})

// update ready status when and trigger the pending actions
setReady();

// set a name for wait task
const { afterLoadingReady, setLoadingReady } = wait('Loading');

// wrap a function to execute after ready
const doThingsAfterLoadingReady = withReady((param1) => {
    // do things with param1
    console.log('being execute afterLoadingReady', param1)
}, afterLoadingReady());

// just call the function, the execution will be delayed to afterLoadingReady
doThingsAfterLoadingReady('hello world');

Changelog

check out CHANGELOG.md

0.6.0

2 years ago

0.5.6

3 years ago

0.5.5

3 years ago

0.5.4

3 years ago

0.5.3

3 years ago

0.5.2

3 years ago

0.5.1

3 years ago

0.5.0

4 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago