Opal-Estate-Pro/node_modules/rxjs/operators/bufferCount.js.map
2019-09-13 09:44:33 +07:00

1 line
7.3 KiB
Plaintext

{"version":3,"file":"bufferCount.js","sourceRoot":"","sources":["../../src/operators/bufferCount.ts"],"names":[],"mappings":";;;;;;AACA,2BAA2B,eAAe,CAAC,CAAA;AAK3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,qBAA+B,UAAkB,EAAE,gBAA+B;IAA/B,gCAA+B,GAA/B,uBAA+B;IAChF,MAAM,CAAC,qCAAqC,MAAqB;QAC/D,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAI,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAC/E,CAAC,CAAC;AACJ,CAAC;AAJe,mBAAW,cAI1B,CAAA;AAED;IAGE,6BAAoB,UAAkB,EAAU,gBAAwB;QAApD,eAAU,GAAV,UAAU,CAAQ;QAAU,qBAAgB,GAAhB,gBAAgB,CAAQ;QACtE,EAAE,CAAC,CAAC,CAAC,gBAAgB,IAAI,UAAU,KAAK,gBAAgB,CAAC,CAAC,CAAC;YACzD,IAAI,CAAC,eAAe,GAAG,qBAAqB,CAAC;QAC/C,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,IAAI,CAAC,eAAe,GAAG,yBAAyB,CAAC;QACnD,CAAC;IACH,CAAC;IAED,kCAAI,GAAJ,UAAK,UAA2B,EAAE,MAAW;QAC3C,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACxG,CAAC;IACH,0BAAC;AAAD,CAAC,AAdD,IAcC;AAED;;;;GAIG;AACH;IAAuC,yCAAa;IAGlD,+BAAY,WAA4B,EAAU,UAAkB;QAClE,kBAAM,WAAW,CAAC,CAAC;QAD6B,eAAU,GAAV,UAAU,CAAQ;QAF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CAAC;QAED,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,GAAI,CAAC;YACnC,IAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAC1B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACnB,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC;gBACjC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBACrB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;IACH,CAAC;IAES,6CAAS,GAAnB;QACE,IAAA,SAAqC,EAA7B,oBAAO,EAAE,4BAAW,CAAU;QAEtC,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1B,IAAI,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;YAC7B,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;gBACtB,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;QACD,gBAAK,CAAC,SAAS,WAAE,CAAC;IACpB,CAAC;IAEH,gCAAC;AAAD,CAAC,AAtCD,CAA2C,uBAAU,GAsCpD","sourcesContent":["import { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { Observable } from '../Observable';\nimport { TeardownLogic } from '../Subscription';\nimport { OperatorFunction } from '../interfaces';\n\n/**\n * Buffers the source Observable values until the size hits the maximum\n * `bufferSize` given.\n *\n * <span class=\"informal\">Collects values from the past as an array, and emits\n * that array only when its size reaches `bufferSize`.</span>\n *\n * <img src=\"./img/bufferCount.png\" width=\"100%\">\n *\n * Buffers a number of values from the source Observable by `bufferSize` then\n * emits the buffer and clears it, and starts a new buffer each\n * `startBufferEvery` values. If `startBufferEvery` is not provided or is\n * `null`, then new buffers are started immediately at the start of the source\n * and when each buffer closes and is emitted.\n *\n * @example <caption>Emit the last two click events as an array</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var buffered = clicks.bufferCount(2);\n * buffered.subscribe(x => console.log(x));\n *\n * @example <caption>On every click, emit the last two click events as an array</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var buffered = clicks.bufferCount(2, 1);\n * buffered.subscribe(x => console.log(x));\n *\n * @see {@link buffer}\n * @see {@link bufferTime}\n * @see {@link bufferToggle}\n * @see {@link bufferWhen}\n * @see {@link pairwise}\n * @see {@link windowCount}\n *\n * @param {number} bufferSize The maximum size of the buffer emitted.\n * @param {number} [startBufferEvery] Interval at which to start a new buffer.\n * For example if `startBufferEvery` is `2`, then a new buffer will be started\n * on every other value from the source. A new buffer is started at the\n * beginning of the source by default.\n * @return {Observable<T[]>} An Observable of arrays of buffered values.\n * @method bufferCount\n * @owner Observable\n */\nexport function bufferCount<T>(bufferSize: number, startBufferEvery: number = null): OperatorFunction<T, T[]> {\n return function bufferCountOperatorFunction(source: Observable<T>) {\n return source.lift(new BufferCountOperator<T>(bufferSize, startBufferEvery));\n };\n}\n\nclass BufferCountOperator<T> implements Operator<T, T[]> {\n private subscriberClass: any;\n\n constructor(private bufferSize: number, private startBufferEvery: number) {\n if (!startBufferEvery || bufferSize === startBufferEvery) {\n this.subscriberClass = BufferCountSubscriber;\n } else {\n this.subscriberClass = BufferSkipCountSubscriber;\n }\n }\n\n call(subscriber: Subscriber<T[]>, source: any): TeardownLogic {\n return source.subscribe(new this.subscriberClass(subscriber, this.bufferSize, this.startBufferEvery));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass BufferCountSubscriber<T> extends Subscriber<T> {\n private buffer: T[] = [];\n\n constructor(destination: Subscriber<T[]>, private bufferSize: number) {\n super(destination);\n }\n\n protected _next(value: T): void {\n const buffer = this.buffer;\n\n buffer.push(value);\n\n if (buffer.length == this.bufferSize) {\n this.destination.next(buffer);\n this.buffer = [];\n }\n }\n\n protected _complete(): void {\n const buffer = this.buffer;\n if (buffer.length > 0) {\n this.destination.next(buffer);\n }\n super._complete();\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass BufferSkipCountSubscriber<T> extends Subscriber<T> {\n private buffers: Array<T[]> = [];\n private count: number = 0;\n\n constructor(destination: Subscriber<T[]>, private bufferSize: number, private startBufferEvery: number) {\n super(destination);\n }\n\n protected _next(value: T): void {\n const { bufferSize, startBufferEvery, buffers, count } = this;\n\n this.count++;\n if (count % startBufferEvery === 0) {\n buffers.push([]);\n }\n\n for (let i = buffers.length; i--; ) {\n const buffer = buffers[i];\n buffer.push(value);\n if (buffer.length === bufferSize) {\n buffers.splice(i, 1);\n this.destination.next(buffer);\n }\n }\n }\n\n protected _complete(): void {\n const { buffers, destination } = this;\n\n while (buffers.length > 0) {\n let buffer = buffers.shift();\n if (buffer.length > 0) {\n destination.next(buffer);\n }\n }\n super._complete();\n }\n\n}\n"]}