ref-once-init
v0.1.0
Published
Init a ref target by promise only once.
Downloads
41
Maintainers
Readme
ref-once-init
🗼 Let Promise Function Executed Only Once.
The
Promise
will be executed when the attribute target is called for the first time, and thePromise
executed will not be executed again when called repeatedly.
The same
Promise
will not be executed twice at the same time. Only the first one will be executed, while the rest can still get the result of thepromise
after executed.
If you are looking for the pure version of once-init(without ref), click me 国内镜像
Once init Promise
- The
Promise Function
packaged byRefOnceInit
will never be executed twice at the same time - If A
Promise Function
is called before previousPromise Function
resolved, It will share the response of the previous one.
Install
Install by package management tools, pnpm
is recommended;
npm install ref-once-init
OR
yarn add ref-once-init
OR
pnpm add ref-once-init
Usage
For example, use ref-once-init
with axios
;