@naturalcycles/js-lib
Version:
Standard library for universal (browser + Node.js) javascript
10 lines (9 loc) • 351 B
TypeScript
/**
* Prevents "swarm" of async calls to the same method.
* Allows max 1 in-flight promise to exist.
* If more calls appear, while Promise is not resolved yet - same Promise is returned.
*
* Does not support `cacheKey`.
* So, the same Promise is returned, regardless of the arguments.
*/
export declare const _SwarmSafe: () => MethodDecorator;