1 |
- {"version":3,"file":"windowToggle.js","sourceRoot":"","sources":["../../src/operator/windowToggle.ts"],"names":[],"mappings":";AAEA,6BAA4C,2BAA2B,CAAC,CAAA;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,sBAAwD,QAAuB,EAC5C,eAAkD;IACnF,MAAM,CAAC,2BAAW,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,IAAI,CAA8B,CAAC;AACnF,CAAC;AAHe,oBAAY,eAG3B,CAAA","sourcesContent":["\nimport { Observable } from '../Observable';\nimport { windowToggle as higherOrder } from '../operators/windowToggle';\n\n/**\n * Branch out the source Observable values as a nested Observable starting from\n * an emission from `openings` and ending when the output of `closingSelector`\n * emits.\n *\n * <span class=\"informal\">It's like {@link bufferToggle}, but emits a nested\n * Observable instead of an array.</span>\n *\n * <img src=\"./img/windowToggle.png\" width=\"100%\">\n *\n * Returns an Observable that emits windows of items it collects from the source\n * Observable. The output Observable emits windows that contain those items\n * emitted by the source Observable between the time when the `openings`\n * Observable emits an item and when the Observable returned by\n * `closingSelector` emits an item.\n *\n * @example <caption>Every other second, emit the click events from the next 500ms</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var openings = Rx.Observable.interval(1000);\n * var result = clicks.windowToggle(openings, i =>\n * i % 2 ? Rx.Observable.interval(500) : Rx.Observable.empty()\n * ).mergeAll();\n * result.subscribe(x => console.log(x));\n *\n * @see {@link window}\n * @see {@link windowCount}\n * @see {@link windowTime}\n * @see {@link windowWhen}\n * @see {@link bufferToggle}\n *\n * @param {Observable<O>} openings An observable of notifications to start new\n * windows.\n * @param {function(value: O): Observable} closingSelector A function that takes\n * the value emitted by the `openings` observable and returns an Observable,\n * which, when it emits (either `next` or `complete`), signals that the\n * associated window should complete.\n * @return {Observable<Observable<T>>} An observable of windows, which in turn\n * are Observables.\n * @method windowToggle\n * @owner Observable\n */\nexport function windowToggle<T, O>(this: Observable<T>, openings: Observable<O>,\n closingSelector: (openValue: O) => Observable<any>): Observable<Observable<T>> {\n return higherOrder(openings, closingSelector)(this) as Observable<Observable<T>>;\n}\n"]}
|