mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-22 12:05:05 +08:00
# Conflicts: # jsowell-ui/.env.development # jsowell-ui/.env.staging # jsowell-ui/bin/build-sit.bat # jsowell-ui/bin/build.bat # jsowell-ui/src/api/adapayMember/adapayMember.js # jsowell-ui/src/api/pile/merchant.js # jsowell-ui/src/router/index.js # jsowell-ui/src/views/financial/financeDetail.vue # jsowell-ui/src/views/financial/merchant.vue # jsowell-ui/src/views/homeIndex/homeIndex.vue # jsowell-ui/src/views/login.vue # jsowell-ui/src/views/pile/basic/detail.vue # jsowell-ui/src/views/pile/station/components/SiteInfo.vue # jsowell-ui/src/views/pile/station/detail.vue # jsowell-ui/src/views/pile/station/orderReport.vue
49 lines
1.9 KiB
TypeScript
49 lines
1.9 KiB
TypeScript
import { OperatorFunction, SubscribableOrPromise } from '../types';
|
|
/**
|
|
* 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>
|
|
*
|
|
* 
|
|
*
|
|
* 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
|
|
*
|
|
* Every other second, emit the click events from the next 500ms
|
|
*
|
|
* ```ts
|
|
* import { fromEvent, interval, EMPTY } from 'rxjs';
|
|
* import { bufferToggle } from 'rxjs/operators';
|
|
*
|
|
* const clicks = fromEvent(document, 'click');
|
|
* const openings = interval(1000);
|
|
* const buffered = clicks.pipe(bufferToggle(openings, i =>
|
|
* i % 2 ? interval(500) : 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[]>;
|