Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 555 Bytes

README.md

File metadata and controls

26 lines (18 loc) · 555 Bytes

waitUntil generalized

waitUntil for usage outside of Service/Cloudflare Workers.

npm i wait-until-generalized
import { WaitUntilList } from 'wait-until-generalized';

const { waitUntil, waitUntilSettled } = new WaitUntilList();

const delay = (ms) => new Promise((res) => setTimeout(res, ms));

waitUntil(delay(1000).then(() => {
  console.log('Waited one second');
  waitUntil(delay(1000).then(() => {
    console.log('Waited another second');
  }));
}));

const results = await waitUntilSettled();

results.length // -> 2