Lock on asynchronous code.
import AsyncLock = require('async-lock'); const lock = new AsyncLock();
lock.acquire( key, () => { // return value or promise }, opts ).then(() => { // lock released });
resource key or keys to lock
function to execute
options
lock.acquire( key, (done) => { // async work done(err, ret); }, (err, ret) => { // lock released }, opts );
callback function
Whether there is any running or pending async function.
Generated using TypeDoc
Lock on asynchronous code.
import AsyncLock = require('async-lock'); const lock = new AsyncLock();
lock.acquire( key, () => { // return value or promise }, opts ).then(() => { // lock released });