Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 332x 332x 78x 78x 78x 78x | export const wait = (ms: number) => new Promise((resolve) => { setTimeout(resolve, ms); }); type Unsubscribe = () => void; export const promisifyEvent = <T = void>( subscribe: ( listener: (result: T) => void, errorListener: (error: Error) => void, ) => Unsubscribe | void, ) => new Promise<T>((resolve, reject) => { const unsubscribe = subscribe( (result) => { unsubscribe?.(); resolve(result); }, (error) => { unsubscribe?.(); reject(error); }, ); }); |