makeSubscriptionPromise
makeSubscriptionPromise<
SubscriptionType
>(terminationOptions
):object
Helps to build a promise associated to a subscription callback through which updates can be pushed to the promise. This promise is resolved with the value of the latest update when a resolution criterion is met. It is rejected with a custom error/reason if a rejection criterion is met or on timeout (optional). Rejection takes precedent.
Type parameters
• SubscriptionType
Parameters
• terminationOptions: TerminationOptions
<SubscriptionType
>
.
Returns
object
An object containing both a subscription callback and a promise which resolves or rejects depending on the values pushed to the callback.
promise
promise:
Promise
<SubscriptionType
>
subscription()
subscription: (
value
) =>void
Parameters
• value: SubscriptionType
Returns
void