async-singleton
make async/promise function execute only one at a time.
Usage
singleton
const asyncSingleton = const delay = { for let i = 0; i < 5; i++ console await }
const singleCountUp = // run // skip thisawait // skip this, but wait for "singleCountUp(0)" to finish // run this
result
0
1
2
3
4
30
31
32
33
34
trailing
When the function being executed is finished, it is executed only once at the last.
const singleCountUp = // run // skip // skip // run, but wait for "sinleCountUp(0)" to finish
result
0
1
2
3
4
30
31
32
33
34