Skip to content

Latest commit

 

History

History
52 lines (35 loc) · 632 Bytes

README.md

File metadata and controls

52 lines (35 loc) · 632 Bytes

async-await-lock

什么是 async-await-lock

用于异步功能的互斥锁

基础用法

安装

npm i async-await-lock

使用

import AsyncAwaitLock from 'async-await-lock';

const lock = new AsyncAwaitLock();

async function serialTask() {
  await lock.acquire();

  try {
    // Don't return a promise here as Promise may resolve after finally
    // has executed
  } finally {
    lock.unlock();
  }
}

Getting Started

Install dependencies,

$ npm i

Start the dev server,

$ npm start

Build documentation,

$ npm run docs:build