bufferTime.js.map 4.3KB

1
  1. {"version":3,"file":"bufferTime.js","sourceRoot":"","sources":["../../src/operator/bufferTime.ts"],"names":[],"mappings":";AACA,sBAAsB,oBAAoB,CAAC,CAAA;AAE3C,4BAA4B,qBAAqB,CAAC,CAAA;AAClD,2BAA0C,yBAAyB,CAAC,CAAA;AAMpE,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,oBAAmD,cAAsB;IACvE,IAAI,MAAM,GAAW,SAAS,CAAC,MAAM,CAAC;IAEtC,IAAI,SAAS,GAAe,aAAK,CAAC;IAClC,EAAE,CAAC,CAAC,yBAAW,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACjD,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC5C,MAAM,EAAE,CAAC;IACX,CAAC;IAED,IAAI,sBAAsB,GAAW,IAAI,CAAC;IAC1C,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,sBAAsB,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,aAAa,GAAW,MAAM,CAAC,iBAAiB,CAAC;IACrD,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,aAAa,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM,CAAC,uBAAW,CAAC,cAAc,EAAE,sBAAsB,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC,IAAI,CAAoB,CAAC;AAChH,CAAC;AApBe,kBAAU,aAoBzB,CAAA","sourcesContent":["import { IScheduler } from '../Scheduler';\nimport { async } from '../scheduler/async';\nimport { Observable } from '../Observable';\nimport { isScheduler } from '../util/isScheduler';\nimport { bufferTime as higherOrder } from '../operators/bufferTime';\n\n/* tslint:disable:max-line-length */\nexport function bufferTime<T>(this: Observable<T>, bufferTimeSpan: number, scheduler?: IScheduler): Observable<T[]>;\nexport function bufferTime<T>(this: Observable<T>, bufferTimeSpan: number, bufferCreationInterval: number, scheduler?: IScheduler): Observable<T[]>;\nexport function bufferTime<T>(this: Observable<T>, bufferTimeSpan: number, bufferCreationInterval: number, maxBufferSize: number, scheduler?: IScheduler): Observable<T[]>;\n/* tslint:enable:max-line-length */\n\n/**\n * Buffers the source Observable values for a specific time period.\n *\n * <span class=\"informal\">Collects values from the past as an array, and emits\n * those arrays periodically in time.</span>\n *\n * <img src=\"./img/bufferTime.png\" width=\"100%\">\n *\n * Buffers values from the source for a specific time duration `bufferTimeSpan`.\n * Unless the optional argument `bufferCreationInterval` is given, it emits and\n * resets the buffer every `bufferTimeSpan` milliseconds. If\n * `bufferCreationInterval` is given, this operator opens the buffer every\n * `bufferCreationInterval` milliseconds and closes (emits and resets) the\n * buffer every `bufferTimeSpan` milliseconds. When the optional argument\n * `maxBufferSize` is specified, the buffer will be closed either after\n * `bufferTimeSpan` milliseconds or when it contains `maxBufferSize` elements.\n *\n * @example <caption>Every second, emit an array of the recent click events</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var buffered = clicks.bufferTime(1000);\n * buffered.subscribe(x => console.log(x));\n *\n * @example <caption>Every 5 seconds, emit the click events from the next 2 seconds</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var buffered = clicks.bufferTime(2000, 5000);\n * buffered.subscribe(x => console.log(x));\n *\n * @see {@link buffer}\n * @see {@link bufferCount}\n * @see {@link bufferToggle}\n * @see {@link bufferWhen}\n * @see {@link windowTime}\n *\n * @param {number} bufferTimeSpan The amount of time to fill each buffer array.\n * @param {number} [bufferCreationInterval] The interval at which to start new\n * buffers.\n * @param {number} [maxBufferSize] The maximum buffer size.\n * @param {Scheduler} [scheduler=async] The scheduler on which to schedule the\n * intervals that determine buffer boundaries.\n * @return {Observable<T[]>} An observable of arrays of buffered values.\n * @method bufferTime\n * @owner Observable\n */\nexport function bufferTime<T>(this: Observable<T>, bufferTimeSpan: number): Observable<T[]> {\n let length: number = arguments.length;\n\n let scheduler: IScheduler = async;\n if (isScheduler(arguments[arguments.length - 1])) {\n scheduler = arguments[arguments.length - 1];\n length--;\n }\n\n let bufferCreationInterval: number = null;\n if (length >= 2) {\n bufferCreationInterval = arguments[1];\n }\n\n let maxBufferSize: number = Number.POSITIVE_INFINITY;\n if (length >= 3) {\n maxBufferSize = arguments[2];\n }\n\n return higherOrder(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler)(this) as Observable<T[]>;\n}\n"]}