You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
2.1 KiB
1 lines
2.1 KiB
{"version":3,"file":"finalize.js","sourceRoot":"","sources":["../../src/operators/finalize.ts"],"names":[],"mappings":";;;;;;AACA,2BAA2B,eAAe,CAAC,CAAA;AAC3C,6BAA4C,iBAAiB,CAAC,CAAA;AAI9D;;;;;;;GAOG;AACH,kBAA4B,QAAoB;IAC9C,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC,EAA1C,CAA0C,CAAC;AAC/E,CAAC;AAFe,gBAAQ,WAEvB,CAAA;AAED;IACE,yBAAoB,QAAoB;QAApB,aAAQ,GAAR,QAAQ,CAAY;IACxC,CAAC;IAED,8BAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,iBAAiB,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC5E,CAAC;IACH,sBAAC;AAAD,CAAC,AAPD,IAOC;AAED;;;;GAIG;AACH;IAAmC,qCAAa;IAC9C,2BAAY,WAA0B,EAAE,QAAoB;QAC1D,kBAAM,WAAW,CAAC,CAAC;QACnB,IAAI,CAAC,GAAG,CAAC,IAAI,2BAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvC,CAAC;IACH,wBAAC;AAAD,CAAC,AALD,CAAmC,uBAAU,GAK5C","sourcesContent":["import { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { Subscription, TeardownLogic } from '../Subscription';\nimport { Observable } from '../Observable';\nimport { MonoTypeOperatorFunction } from '../interfaces';\n\n/**\n * Returns an Observable that mirrors the source Observable, but will call a specified function when\n * the source terminates on complete or error.\n * @param {function} callback Function to be called when source terminates.\n * @return {Observable} An Observable that mirrors the source, but will call the specified function on termination.\n * @method finally\n * @owner Observable\n */\nexport function finalize<T>(callback: () => void): MonoTypeOperatorFunction<T> {\n return (source: Observable<T>) => source.lift(new FinallyOperator(callback));\n}\n\nclass FinallyOperator<T> implements Operator<T, T> {\n constructor(private callback: () => void) {\n }\n\n call(subscriber: Subscriber<T>, source: any): TeardownLogic {\n return source.subscribe(new FinallySubscriber(subscriber, this.callback));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass FinallySubscriber<T> extends Subscriber<T> {\n constructor(destination: Subscriber<T>, callback: () => void) {\n super(destination);\n this.add(new Subscription(callback));\n }\n}\n"]} |