mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 00:25:46 -06:00
* more friday any/type assertion improvements * Apply suggestions from code review Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com> * Update public/app/angular/promiseToDigest.test.ts Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com> Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
17 lines
375 B
TypeScript
17 lines
375 B
TypeScript
export class Deferred<T = unknown> {
|
|
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);
|
|
}
|
|
}
|