await-lock:互斥锁用于异步功能

时间:2024-05-22 10:04:21
【文件属性】:

文件名称:await-lock:互斥锁用于异步功能

文件大小:69KB

文件格式:ZIP

更新时间:2024-05-22 10:04:21

concurrency async-await mutex-lock TypeScript

等候锁 互斥锁用于异步功能 用法 import AwaitLock from 'await-lock' ; let lock = new AwaitLock ( ) ; async function runSerialTaskAsync ( ) { await lock . acquireAsync ( ) ; try { // IMPORTANT: Do not return a promise from here because the finally clause // may run before the promise settles, and the catch clause will not run if // the promise is rejected } finally { lock . release ( ) ; }


【文件预览】:
await-lock-master
----.gitignore(533B)
----package.json(1KB)
----src()
--------AwaitLock.ts(2KB)
--------__tests__()
----LICENSE(1KB)
----tsconfig.json(316B)
----.github()
--------workflows()
----README.md(1KB)
----babel.config.js(235B)
----.prettierrc(73B)
----yarn.lock(161KB)

网友评论