UNPKG

@lifaon/rx-js-light

Version:

Blazing fast Observables

22 lines (21 loc) 797 B
import {throwError} from "../../../../../../built-in/from/with-notifications/others/throw-error/throw-error.mjs"; import {singleWithNotifications} from "../../../../../../built-in/from/with-notifications/values/single/single-with-notifications.mjs"; import {thenObservable} from "../../then-observable.mjs"; import {fulfilledObservable} from "../fulfilled/fulfilled-observable.mjs"; export function finallyObservable(subscribe, onFinally) { return thenObservable(subscribe, value => { return fulfilledObservable(onFinally({ state: 'fulfilled', value }), () => { return singleWithNotifications(value); }); }, error => { return fulfilledObservable(onFinally({ state: 'rejected', error }), () => { return throwError(error); }); }); }