Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Latest commit

 

History

History
45 lines (29 loc) · 1.49 KB

README.md

File metadata and controls

45 lines (29 loc) · 1.49 KB

ref-once-init

npm gzip size

🗼 Let Promise Function Executed Only Once.

The Promise will be executed when the attribute target is called for the first time, and the Promise 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 the promise after executed.

If you are looking for the pure version of once-init(without ref), click me 国内镜像

Once init Promise

  1. The Promise Function packaged by RefOnceInit will never be executed twice at the same time
  2. If A Promise Function is called before previous Promise Function resolved, It will share the response of the previous one.
  3. Example Site

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;