mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 04:59:15 -06:00
17 lines
371 B
TypeScript
17 lines
371 B
TypeScript
export class Deferred<T = any> {
|
|
resolve?: (reason: T | PromiseLike<T>) => void;
|
|
reject?: (reason?: any) => void;
|
|
promise: Promise<T>;
|
|
|
|
constructor() {
|
|
this.resolve = undefined;
|
|
this.reject = undefined;
|
|
|
|
this.promise = new Promise((resolve, reject) => {
|
|
this.resolve = resolve;
|
|
this.reject = reject;
|
|
});
|
|
Object.freeze(this);
|
|
}
|
|
}
|