UNPKG

echogarden

Version:

An easy-to-use speech toolset. Includes tools for synthesis, recognition, alignment, speech translation, language detection, source separation and more.

14 lines (12 loc) 402 B
export class OpenPromise<T = void> { promise: Promise<T> resolve: (value: T) => void = () => { throw new Error('Open promise resolved before initialization') } reject: (reason?: any) => void = () => { throw new Error('Open promise rejected before initialization') } constructor() { this.promise = new Promise<T>((resolve, reject) => { this.resolve = resolve this.reject = reject }) } }