mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-06-12 05:31:41 +00:00
update
This commit is contained in:
41
node_modules/rxjs/operators/bufferToggle.d.ts
generated
vendored
Normal file
41
node_modules/rxjs/operators/bufferToggle.d.ts
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
import { SubscribableOrPromise } from '../Observable';
|
||||
import { OperatorFunction } from '../interfaces';
|
||||
/**
|
||||
* 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 declare function bufferToggle<T, O>(openings: SubscribableOrPromise<O>, closingSelector: (value: O) => SubscribableOrPromise<any>): OperatorFunction<T, T[]>;
|
Reference in New Issue
Block a user