mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
9 lines
342 B
TypeScript
9 lines
342 B
TypeScript
// Copyright: Ankitects Pty Ltd and contributors
|
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
export function promiseWithResolver<T>(): [Promise<T>, (value: T) => void] {
|
|
let resolve: (object: T) => void;
|
|
const promise = new Promise<T>((res) => (resolve = res));
|
|
|
|
return [promise, resolve!];
|
|
}
|