UNPKG

promise-make-counter

Version:

A simple function that makes a counter-based promise, which can be incremented and decremented, and it resolves once its counter reaches zero.

8 lines (7 loc) 155 B
type Result = { promise: Promise<void>; isPending: () => boolean; increment: () => void; decrement: () => void; }; export type { Result };