|
|
|
|
|
by neallindsay
341 days ago
|
|
Promises in JS make this stuff much easier (at least to my mind): const lockify = f => { let lock = Promise.resolve()
return (...args) => {
const result = lock.then(() => f(...args))
lock = result.catch(() => {})
return result.then(v => v)
}
}
|
|