本文整理匯總了TypeScript中rxjs/operators.window函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript window函數的具體用法?TypeScript window怎麽用?TypeScript window使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了window函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should return a single empty window if source is sync empty and closing is sync empty', () => {
const source = cold('(|)');
const sourceSubs = '(^!)';
const expected = '(w|)';
const w = cold('|');
const expectedValues = { w: w };
const result = source.pipe(window(EMPTY));
expectObservable(result).toBe(expected, expectedValues);
expectSubscriptions(source.subscriptions).toBe(sourceSubs);
// expectSubscriptions(closings.subscriptions).toBe(closingSubs);
});
示例2: cold
() => {
const source = cold('(a|)');
const sourceSubs = '(^!)';
const closings = cold('-');
const closingSubs = '(^!)';
const expected = '(w|)';
const w = cold('(a|)');
const expectedValues = { w: w };
const result = source.pipe(window(closings));
expectObservable(result).toBe(expected, expectedValues);
expectSubscriptions(source.subscriptions).toBe(sourceSubs);
expectSubscriptions(closings.subscriptions).toBe(closingSubs);
});
示例3: asDiagram
asDiagram('window')('should emit windows that close and reopen', () => {
const source = hot('---a---b---c---d---e---f---g---h---i---| ');
const sourceSubs = '^ ! ';
const closings = hot('-------------w------------w----------------|');
const closingSubs = '^ ! ';
const expected = 'x------------y------------z------------| ';
const x = cold( '---a---b---c-| ');
const y = cold( '--d---e---f--| ');
const z = cold( '-g---h---i---| ');
const expectedValues = { x: x, y: y, z: z };
const result = source.pipe(window(closings));
expectObservable(result).toBe(expected, expectedValues);
expectSubscriptions(source.subscriptions).toBe(sourceSubs);
expectSubscriptions(closings.subscriptions).toBe(closingSubs);
});