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.
Returns
An object containing both a subscription callback
and a promise which resolves or rejects depending on the values pushed to the callback.
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.
Returns
An object containing both a subscription callback and a promise which resolves or rejects depending on the values pushed to the callback.