本文整理汇总了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);
});