Subtheme of barrio
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
3.8 KiB

{"version":3,"file":"skipUntil.js","sourceRoot":"","sources":["../../src/operators/skipUntil.ts"],"names":[],"mappings":";;;;;;AAIA,gCAAgC,oBAAoB,CAAC,CAAA;AAErD,kCAAkC,2BAA2B,CAAC,CAAA;AAG9D;;;;;;;;;;;GAWG;AACH,mBAA6B,QAAyB;IACpD,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAAC,EAA5C,CAA4C,CAAC;AACjF,CAAC;AAFe,iBAAS,YAExB,CAAA;AAED;IACE,2BAAoB,QAAyB;QAAzB,aAAQ,GAAR,QAAQ,CAAiB;IAC7C,CAAC;IAED,gCAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,mBAAmB,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9E,CAAC;IACH,wBAAC;AAAD,CAAC,AAPD,IAOC;AAED;;;;GAIG;AACH;IAAwC,uCAAqB;IAK3D,6BAAY,WAA4B,EAC5B,QAAyB;QACnC,kBAAM,WAAW,CAAC,CAAC;QALb,aAAQ,GAAY,KAAK,CAAC;QAC1B,mBAAc,GAAY,KAAK,CAAC;QAKtC,IAAI,CAAC,GAAG,CAAC,qCAAiB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC9C,CAAC;IAES,mCAAK,GAAf,UAAgB,KAAQ;QACtB,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;YAClB,gBAAK,CAAC,KAAK,YAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IAES,uCAAS,GAAnB;QACE,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;YACxB,gBAAK,CAAC,SAAS,WAAE,CAAC;QACpB,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,CAAC;IACH,CAAC;IAED,wCAAU,GAAV,UAAW,UAAa,EAAE,UAAa,EAC5B,UAAkB,EAAE,UAAkB,EACtC,QAA+B;QACxC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;IAED,4CAAc,GAAd;QACE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;YACnB,gBAAK,CAAC,SAAS,WAAE,CAAC;QACpB,CAAC;IACH,CAAC;IACH,0BAAC;AAAD,CAAC,AArCD,CAAwC,iCAAe,GAqCtD","sourcesContent":["import { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { Observable } from '../Observable';\nimport { TeardownLogic } from '../Subscription';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { InnerSubscriber } from '../InnerSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nimport { MonoTypeOperatorFunction } from '../interfaces';\n\n/**\n * Returns an Observable that skips items emitted by the source Observable until a second Observable emits an item.\n *\n * <img src=\"./img/skipUntil.png\" width=\"100%\">\n *\n * @param {Observable} notifier - The second Observable that has to emit an item before the source Observable's elements begin to\n * be mirrored by the resulting Observable.\n * @return {Observable<T>} An Observable that skips items from the source Observable until the second Observable emits\n * an item, then emits the remaining items.\n * @method skipUntil\n * @owner Observable\n */\nexport function skipUntil<T>(notifier: Observable<any>): MonoTypeOperatorFunction<T> {\n return (source: Observable<T>) => source.lift(new SkipUntilOperator(notifier));\n}\n\nclass SkipUntilOperator<T> implements Operator<T, T> {\n constructor(private notifier: Observable<any>) {\n }\n\n call(subscriber: Subscriber<T>, source: any): TeardownLogic {\n return source.subscribe(new SkipUntilSubscriber(subscriber, this.notifier));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass SkipUntilSubscriber<T, R> extends OuterSubscriber<T, R> {\n\n private hasValue: boolean = false;\n private isInnerStopped: boolean = false;\n\n constructor(destination: Subscriber<any>,\n notifier: Observable<any>) {\n super(destination);\n this.add(subscribeToResult(this, notifier));\n }\n\n protected _next(value: T) {\n if (this.hasValue) {\n super._next(value);\n }\n }\n\n protected _complete() {\n if (this.isInnerStopped) {\n super._complete();\n } else {\n this.unsubscribe();\n }\n }\n\n notifyNext(outerValue: T, innerValue: R,\n outerIndex: number, innerIndex: number,\n innerSub: InnerSubscriber<T, R>): void {\n this.hasValue = true;\n }\n\n notifyComplete(): void {\n this.isInnerStopped = true;\n if (this.isStopped) {\n super._complete();\n }\n }\n}\n"]}