當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。