There are some helpfull decorators in this project for async class methods and functions.
Install
npm install --save async-decorators
Import
import {memoize, serialize, isSkipError} from 'async-decorators';
Memoize decorator
has parameters expireMs
and cacheSize
usage:
@ async { return await ; }
or just
const asyncFn = ;
See example source
npm run example_memoize
and test source
npm run test_memoize
Serialize decorator
Serializes async method calls. (Make a new async call only if previous is completed) If there are more than one pending async calls, skip all but the last.
usage:
@ async { return await ; }
or just
const sfn =
See example source
npm run example_serialize
Both decorator usage
@ @ async { return await ; }
See example source
npm run example_ser_memoize