/** * Author: Big Red * Copyright 2019 Alert Logic, Inc. */ /** * @public * * AlBehaviorPromise is a simple extension of Promise that replicates the functionality provided by RxJS's BehaviorSubject. * Promises already provide multicasting functionality, but it can be deucedly inconvenient to provide an inline * executor, and rather obtuse to change the resolved value. * * This class exposes the basic surface area of a Promise -- it is `then`able -- but allows the resolved value to change * if necessary. */ export declare class AlBehaviorPromise { protected promise: Promise; protected resolver?: { (result: ResultType): void; }; protected rejector?: { (error: any): void; }; protected fulfilled: boolean; protected value: ResultType | null; constructor(initialValue?: ResultType | null); /** * Attaches a resolve/reject listener to the underlying promise. */ then(callback?: ((value: ResultType) => TResult1 | PromiseLike) | undefined | null, error?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; /** * Resolves the underlying promise with the given value. */ resolve(result: ResultType): void; /** * Rejects the underlying promise with the given reason. */ reject(reason: any): void; /** * Resets the promise back into an unfulfilled state. */ rescind(): void; /** * Gets the last resolved value. */ getValue(): ResultType | null; /** * Gets the fulfilled/pending state of the underlying promise. */ isFulfilled(): boolean; }