packageDocumentation module see alpha export type AsyncMutexUnlockFnType = ( ) => void ; alpha export class AsyncMutex { private _mutex = Promise . resolve ( ) ; /**
     * Await the return value to setup a lock. The return value
     * is also the unlock function that can be called to unlock
     * the mutex.
     */ public async lock ( ) { /**
         * Note: The promise returned by this method will resolve (with the unlock function, which is actually the
         * mutex’s then’s resolve function) once any previous mutexes have finished and called their
         * respective unlock function that was yielded over their promise.
         */ let begin = ( _unlock ) => { } ; this . _mutex = this . _mutex . then ( async ( ) : Promise < void > => { return new Promise ( begin ) ; } ) ; return new Promise ( ( res ) => { begin = res ; } ) ; } }