export interface ReadySignal < T = void > { wait ( ) : Promise < T > ; signal ( value ) : void ; } export function createReadySignal < T > ( ) { let resolver ; const promise = new Promise < T > ( ( resolve ) => { resolver = resolve ; } ) ; async function wait ( ) { return await promise ; } function signal ( value ) { resolver ( value ) ; } return { wait , signal } ; }