当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript operators.window函数代码示例

本文整理汇总了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);
  });
开发者ID:DallanQ,项目名称:rxjs,代码行数:13,代码来源:window-spec.ts

示例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);
  });
开发者ID:DallanQ,项目名称:rxjs,代码行数:15,代码来源:window-spec.ts

示例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);
  });
开发者ID:DallanQ,项目名称:rxjs,代码行数:17,代码来源:window-spec.ts


注:本文中的rxjs/operators.window函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。