Skip to content

uglyer/async-await-lock

Repository files navigation

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

About

用于异步功能的互斥锁

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published