lunaisadev-website-old/node_modules/rxjs/operators/windowWhen.js.map

1 line
7.3 KiB
Plaintext

{"version":3,"file":"windowWhen.js","sourceRoot":"","sources":["../../src/operators/windowWhen.ts"],"names":[],"mappings":";;;;;;AAGA,wBAAwB,YAAY,CAAC,CAAA;AAErC,yBAAyB,kBAAkB,CAAC,CAAA;AAC5C,4BAA4B,qBAAqB,CAAC,CAAA;AAClD,gCAAgC,oBAAoB,CAAC,CAAA;AAErD,kCAAkC,2BAA2B,CAAC,CAAA;AAG9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,oBAA8B,eAAsC;IAClE,MAAM,CAAC,oCAAoC,MAAqB;QAC9D,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,cAAc,CAAI,eAAe,CAAC,CAAC,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC;AAJe,kBAAU,aAIzB,CAAA;AAED;IACE,wBAAoB,eAAsC;QAAtC,oBAAe,GAAf,eAAe,CAAuB;IAC1D,CAAC;IAED,6BAAI,GAAJ,UAAK,UAAqC,EAAE,MAAW;QACrD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;IAClF,CAAC;IACH,qBAAC;AAAD,CAAC,AAPD,IAOC;AAED;;;;GAIG;AACH;IAAkC,oCAAuB;IAIvD,0BAAsB,WAAsC,EACxC,eAAsC;QACxD,kBAAM,WAAW,CAAC,CAAC;QAFC,gBAAW,GAAX,WAAW,CAA2B;QACxC,oBAAe,GAAf,eAAe,CAAuB;QAExD,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAED,qCAAU,GAAV,UAAW,UAAa,EAAE,UAAe,EAC9B,UAAkB,EAAE,UAAkB,EACtC,QAAiC;QAC1C,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IAED,sCAAW,GAAX,UAAY,KA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CAAC;QAC9C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE9B,IAAM,eAAe,GAAG,mBAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;QACzD,EAAE,CAAC,CAAC,eAAe,KAAK,yBAAW,CAAC,CAAC,CAAC;YACpC,IAAM,GAAG,GAAG,yBAAW,CAAC,CAAC,CAAC;YAC1B,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,GAAG,qCAAiB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;IACH,uBAAC;AAAD,CAAC,AArED,CAAkC,iCAAe,GAqEhD","sourcesContent":["import { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { Observable } from '../Observable';\nimport { Subject } from '../Subject';\nimport { Subscription } from '../Subscription';\nimport { tryCatch } from '../util/tryCatch';\nimport { errorObject } from '../util/errorObject';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { InnerSubscriber } from '../InnerSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nimport { OperatorFunction } from '../interfaces';\n\n/**\n * Branch out the source Observable values as a nested Observable using a\n * factory function of closing Observables to determine when to start a new\n * window.\n *\n * <span class=\"informal\">It's like {@link bufferWhen}, but emits a nested\n * Observable instead of an array.</span>\n *\n * <img src=\"./img/windowWhen.png\" width=\"100%\">\n *\n * Returns an Observable that emits windows of items it collects from the source\n * Observable. The output Observable emits connected, non-overlapping windows.\n * It emits the current window and opens a new one whenever the Observable\n * produced by the specified `closingSelector` function emits an item. The first\n * window is opened immediately when subscribing to the output Observable.\n *\n * @example <caption>Emit only the first two clicks events in every window of [1-5] random seconds</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks\n * .windowWhen(() => Rx.Observable.interval(1000 + Math.random() * 4000))\n * .map(win => win.take(2)) // each window has at most 2 emissions\n * .mergeAll(); // flatten the Observable-of-Observables\n * result.subscribe(x => console.log(x));\n *\n * @see {@link window}\n * @see {@link windowCount}\n * @see {@link windowTime}\n * @see {@link windowToggle}\n * @see {@link bufferWhen}\n *\n * @param {function(): Observable} closingSelector A function that takes no\n * arguments and returns an Observable that signals (on either `next` or\n * `complete`) when to close the previous window and start a new one.\n * @return {Observable<Observable<T>>} An observable of windows, which in turn\n * are Observables.\n * @method windowWhen\n * @owner Observable\n */\nexport function windowWhen<T>(closingSelector: () => Observable<any>): OperatorFunction<T, Observable<T>> {\n return function windowWhenOperatorFunction(source: Observable<T>) {\n return source.lift(new WindowOperator<T>(closingSelector));\n };\n}\n\nclass WindowOperator<T> implements Operator<T, Observable<T>> {\n constructor(private closingSelector: () => Observable<any>) {\n }\n\n call(subscriber: Subscriber<Observable<T>>, source: any): any {\n return source.subscribe(new WindowSubscriber(subscriber, this.closingSelector));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass WindowSubscriber<T> extends OuterSubscriber<T, any> {\n private window: Subject<T>;\n private closingNotification: Subscription;\n\n constructor(protected destination: Subscriber<Observable<T>>,\n private closingSelector: () => Observable<any>) {\n super(destination);\n this.openWindow();\n }\n\n notifyNext(outerValue: T, innerValue: any,\n outerIndex: number, innerIndex: number,\n innerSub: InnerSubscriber<T, any>): void {\n this.openWindow(innerSub);\n }\n\n notifyError(error: any, innerSub: InnerSubscriber<T, any>): void {\n this._error(error);\n }\n\n notifyComplete(innerSub: InnerSubscriber<T, any>): void {\n this.openWindow(innerSub);\n }\n\n protected _next(value: T): void {\n this.window.next(value);\n }\n\n protected _error(err: any): void {\n this.window.error(err);\n this.destination.error(err);\n this.unsubscribeClosingNotification();\n }\n\n protected _complete(): void {\n this.window.complete();\n this.destination.complete();\n this.unsubscribeClosingNotification();\n }\n\n private unsubscribeClosingNotification(): void {\n if (this.closingNotification) {\n this.closingNotification.unsubscribe();\n }\n }\n\n private openWindow(innerSub: InnerSubscriber<T, any> = null): void {\n if (innerSub) {\n this.remove(innerSub);\n innerSub.unsubscribe();\n }\n\n const prevWindow = this.window;\n if (prevWindow) {\n prevWindow.complete();\n }\n\n const window = this.window = new Subject<T>();\n this.destination.next(window);\n\n const closingNotifier = tryCatch(this.closingSelector)();\n if (closingNotifier === errorObject) {\n const err = errorObject.e;\n this.destination.error(err);\n this.window.error(err);\n } else {\n this.add(this.closingNotification = subscribeToResult(this, closingNotifier));\n }\n }\n}\n"]}