Sha256: a5976f0881cd64d2441d1b6fce65c55868c460ffa41c3f924028ef57d34ad0d6

Contents?: true

Size: 1.94 KB

Versions: 49

Compression:

Stored size: 1.94 KB

Contents

/** PURE_IMPORTS_START .._operators_bufferToggle PURE_IMPORTS_END */
import { bufferToggle as higherOrder } from '../operators/bufferToggle';
/**
 * Buffers the source Observable values starting from an emission from
 * `openings` and ending when the output of `closingSelector` emits.
 *
 * <span class="informal">Collects values from the past as an array. Starts
 * collecting only when `opening` emits, and calls the `closingSelector`
 * function to get an Observable that tells when to close the buffer.</span>
 *
 * <img src="./img/bufferToggle.png" width="100%">
 *
 * Buffers values from the source by opening the buffer via signals from an
 * Observable provided to `openings`, and closing and sending the buffers when
 * a Subscribable or Promise returned by the `closingSelector` function emits.
 *
 * @example <caption>Every other second, emit the click events from the next 500ms</caption>
 * var clicks = Rx.Observable.fromEvent(document, 'click');
 * var openings = Rx.Observable.interval(1000);
 * var buffered = clicks.bufferToggle(openings, i =>
 *   i % 2 ? Rx.Observable.interval(500) : Rx.Observable.empty()
 * );
 * buffered.subscribe(x => console.log(x));
 *
 * @see {@link buffer}
 * @see {@link bufferCount}
 * @see {@link bufferTime}
 * @see {@link bufferWhen}
 * @see {@link windowToggle}
 *
 * @param {SubscribableOrPromise<O>} openings A Subscribable or Promise of notifications to start new
 * buffers.
 * @param {function(value: O): SubscribableOrPromise} closingSelector A function that takes
 * the value emitted by the `openings` observable and returns a Subscribable or Promise,
 * which, when it emits, signals that the associated buffer should be emitted
 * and cleared.
 * @return {Observable<T[]>} An observable of arrays of buffered values.
 * @method bufferToggle
 * @owner Observable
 */
export function bufferToggle(openings, closingSelector) {
    return higherOrder(openings, closingSelector)(this);
}
//# sourceMappingURL=bufferToggle.js.map

Version data entries

49 entries across 49 versions & 4 rubygems

Version Path
ilog-0.4.1 node_modules/rxjs/_esm5/operator/bufferToggle.js
ilog-0.4.0 node_modules/rxjs/_esm5/operator/bufferToggle.js
ilog-0.3.3 node_modules/rxjs/_esm5/operator/bufferToggle.js
govuk_publishing_components-18.0.0 node_modules/rxjs/_esm5/operator/bufferToggle.js
govuk_publishing_components-17.21.0 node_modules/rxjs/_esm5/operator/bufferToggle.js
govuk_publishing_components-17.20.0 node_modules/rxjs/_esm5/operator/bufferToggle.js
govuk_publishing_components-17.19.1 node_modules/rxjs/_esm5/operator/bufferToggle.js
govuk_publishing_components-17.19.0 node_modules/rxjs/_esm5/operator/bufferToggle.js
govuk_publishing_components-17.18.0 node_modules/rxjs/_esm5/operator/bufferToggle.js
govuk_publishing_components-17.17.0 node_modules/rxjs/_esm5/operator/bufferToggle.js
govuk_publishing_components-17.16.0 node_modules/rxjs/_esm5/operator/bufferToggle.js
govuk_publishing_components-17.15.0 node_modules/rxjs/_esm5/operator/bufferToggle.js
govuk_publishing_components-17.14.0 node_modules/rxjs/_esm5/operator/bufferToggle.js
govuk_publishing_components-17.13.0 node_modules/rxjs/_esm5/operator/bufferToggle.js
govuk_publishing_components-17.12.2 node_modules/rxjs/_esm5/operator/bufferToggle.js
govuk_publishing_components-17.12.1 node_modules/rxjs/_esm5/operator/bufferToggle.js
govuk_publishing_components-17.12.0 node_modules/rxjs/_esm5/operator/bufferToggle.js
govuk_publishing_components-17.11.0 node_modules/rxjs/_esm5/operator/bufferToggle.js
govuk_publishing_components-17.10.0 node_modules/rxjs/_esm5/operator/bufferToggle.js
govuk_publishing_components-17.9.0 node_modules/rxjs/_esm5/operator/bufferToggle.js