Sleep and wait for asynchronous processing to complete.
Homepage Repository npm Download
npm install sleep-and-wait@1.0.0
Sleep and wait for asynchronous processing to complete.
npm install sleep-and-wait
const sleep = require('sleep-and-wait');
sleep(100).for.promise(...).timeout(10000);
// Sleep every 100ms waiting for the promise to complete, timeout after 10s
sleep(50).for.condition(()=>{...}).timeout(5000);
// Sleep every 50ms waiting for the condition become true, timeout after 5s
sleep(10).for.stream(...).timeout(2000);
// Sleep every 10ms waiting for the stream to end or close, timeout after 2s
Please contact to email