@lifaon/rx-js-light
Version:
Blazing fast Observables
28 lines (27 loc) • 1.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.finallyObservable = void 0;
var throw_error_1 = require("../../../../../../built-in/from/with-notifications/others/throw-error/throw-error.cjs");
var single_with_notifications_1 = require("../../../../../../built-in/from/with-notifications/values/single/single-with-notifications.cjs");
var then_observable_1 = require("../../then-observable.cjs");
var fulfilled_observable_1 = require("../fulfilled/fulfilled-observable.cjs");
function finallyObservable(subscribe, onFinally) {
return (0, then_observable_1.thenObservable)(subscribe, function (value) {
return (0, fulfilled_observable_1.fulfilledObservable)(onFinally({
state: 'fulfilled',
value: value
}), function () {
return (0, single_with_notifications_1.singleWithNotifications)(value);
});
}, function (error) {
return (0, fulfilled_observable_1.fulfilledObservable)(onFinally({
state: 'rejected',
error: error
}), function () {
return (0, throw_error_1.throwError)(error);
});
});
}
exports.finallyObservable = finallyObservable;