finalize.js 1.0 KB

1234567891011121314151617181920212223242526
  1. /** PURE_IMPORTS_START tslib,_Subscriber,_Subscription PURE_IMPORTS_END */
  2. import * as tslib_1 from "tslib";
  3. import { Subscriber } from '../Subscriber';
  4. import { Subscription } from '../Subscription';
  5. export function finalize(callback) {
  6. return function (source) { return source.lift(new FinallyOperator(callback)); };
  7. }
  8. var FinallyOperator = /*@__PURE__*/ (function () {
  9. function FinallyOperator(callback) {
  10. this.callback = callback;
  11. }
  12. FinallyOperator.prototype.call = function (subscriber, source) {
  13. return source.subscribe(new FinallySubscriber(subscriber, this.callback));
  14. };
  15. return FinallyOperator;
  16. }());
  17. var FinallySubscriber = /*@__PURE__*/ (function (_super) {
  18. tslib_1.__extends(FinallySubscriber, _super);
  19. function FinallySubscriber(destination, callback) {
  20. var _this = _super.call(this, destination) || this;
  21. _this.add(new Subscription(callback));
  22. return _this;
  23. }
  24. return FinallySubscriber;
  25. }(Subscriber));
  26. //# sourceMappingURL=finalize.js.map