• 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

    Returns {
        promise: Promise<SubscriptionType>;
        subscription: ((value) => void);
    }

    An object containing both a subscription callback and a promise which resolves or rejects depending on the values pushed to the callback.

    • promise: Promise<SubscriptionType>
    • subscription: ((value) => void)
        • (value): void
        • Parameters

          • value: SubscriptionType

          Returns void