Create a mutex, to run async callbacks one at a time
import { sleep, createMutex } from '@gpahal/std/promises'const mutex = createMutex()async function runSomethingSequentially() { await mutex.runExclusive(async () => { await sleep(100) })} Copy
import { sleep, createMutex } from '@gpahal/std/promises'const mutex = createMutex()async function runSomethingSequentially() { await mutex.runExclusive(async () => { await sleep(100) })}
Create a mutex, to run async callbacks one at a time