/**
 * Caches a promise on the first call and always returns the same promise after that
 */ export class CachedPromise < T > { private _promise : Promise < T > | undefined ; public getOrCachePromise ( createPromise ) { if ( ! this . _promise ) { this . _promise = createPromise ( ) ; } return this . _promise ; } }