The function used to check equality between different values. This can be manually set at any time to change the function used.
ReadonlylastThe last resolved value. This only changes when value is set to a resolved value or when a
promise value resolves.
Do not set this directly. Use AsyncObservable.setValue instead.
ProtectedlastUsed to prevent setting different values from racing with each other.
ProtectedlastProtected ReadonlylistenerThis is necessary so we can fire listeners that listen directly to the value, not the emitted event.
ReadonlyvalueThe value which this observable currently contains. In this AsyncObservable, value may be
a promise, a resolved value, or an error.
Do not set this directly. Use AsyncObservable.setValue instead.
ProtectedwaitingClean up all listeners and any other internal state.
ProtecteddispatchDispatch a typed event. Causes all attached listeners listening to this event to be fired.
The number of listeners that were fired.
Get a count of all currently attached listeners. If a listener is removed, it will no longer be counted.
Listen to changes in the observable's value.
If true, the callback will immediately be fired with whatever the current value is.
The callback to fire when a new value is set on the observable.
A callback to remove the listener.
Listen to any event omitted by the observable rather than just the value changing.
Optionaloptions: PartialWithUndefined<{}>A callback to remove the listener.
ProtectedrejectInternally updates the current value when a promise value has been rejected or an error value is given.
Remove all currently attached event listeners.
The number of listeners that were removed.
Removes a listener from the observable.
true if the callback was removed. false if the callback was not removed (meaning
it was never added in the first place).
ProtectedresolveInternally updates the current value when a promise value has been resolved or a non-promise value is given.
ProtectedsetInternally sets a new promise as the current value. This is called by AsyncObservable.setValue if the given value is a promise.
Set a new value to the observable. If a promise is used, value will be set to the promise
and value will be automatically overridden with the resolution or rejection result of the
promise once it's available.
New resolved values will only be set and listeners will only be fired if it is not equal to
the current value (as determined by equalityCheck).
true if the new value was set, false otherwise.
An observable that can handle promises and updates listeners for each stage in the promise lifecycle. It also stores the last resolved value.