1 |
- {"version":3,"file":"bufferWhen.js","sourceRoot":"","sources":["../../src/operator/bufferWhen.ts"],"names":[],"mappings":";AAEA,2BAA0C,yBAAyB,CAAC,CAAA;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,oBAAmD,eAAsC;IACvF,MAAM,CAAC,uBAAW,CAAC,eAAe,CAAC,CAAC,IAAI,CAAoB,CAAC;AAC/D,CAAC;AAFe,kBAAU,aAEzB,CAAA","sourcesContent":["\nimport { Observable } from '../Observable';\nimport { bufferWhen as higherOrder } from '../operators/bufferWhen';\n\n/**\n * Buffers the source Observable values, using a factory function of closing\n * Observables to determine when to close, emit, and reset the buffer.\n *\n * <span class=\"informal\">Collects values from the past as an array. When it\n * starts collecting values, it calls a function that returns an Observable that\n * tells when to close the buffer and restart collecting.</span>\n *\n * <img src=\"./img/bufferWhen.png\" width=\"100%\">\n *\n * Opens a buffer immediately, then closes the buffer when the observable\n * returned by calling `closingSelector` function emits a value. When it closes\n * the buffer, it immediately opens a new buffer and repeats the process.\n *\n * @example <caption>Emit an array of the last clicks every [1-5] random seconds</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var buffered = clicks.bufferWhen(() =>\n * Rx.Observable.interval(1000 + Math.random() * 4000)\n * );\n * buffered.subscribe(x => console.log(x));\n *\n * @see {@link buffer}\n * @see {@link bufferCount}\n * @see {@link bufferTime}\n * @see {@link bufferToggle}\n * @see {@link windowWhen}\n *\n * @param {function(): Observable} closingSelector A function that takes no\n * arguments and returns an Observable that signals buffer closure.\n * @return {Observable<T[]>} An observable of arrays of buffered values.\n * @method bufferWhen\n * @owner Observable\n */\nexport function bufferWhen<T>(this: Observable<T>, closingSelector: () => Observable<any>): Observable<T[]> {\n return higherOrder(closingSelector)(this) as Observable<T[]>;\n}\n"]}
|