0.1.0 • Published 4 years ago
ref-once-init v0.1.0
ref-once-init
🗼 Let Promise Function Executed Only Once.
The
Promisewill be executed when the attribute target is called for the first time, and thePromiseexecuted will not be executed again when called repeatedly.The same
Promisewill not be executed twice at the same time. Only the first one will be executed, while the rest can still get the result of thepromiseafter executed.
If you are looking for the pure version of once-init(without ref), click me 国内镜像
Once init Promise
- The
Promise Functionpackaged byRefOnceInitwill never be executed twice at the same time - If A
Promise Functionis called before previousPromise Functionresolved, It will share the response of the previous one.
Install
Install by package management tools, pnpm is recommended;
npm install ref-once-initOR
yarn add ref-once-initOR
pnpm add ref-once-initUsage
For example, use ref-once-init with axios;
0.1.0
4 years ago