當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript operators.concat函數代碼示例

本文整理匯總了TypeScript中rxjs/operators.concat函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript concat函數的具體用法?TypeScript concat怎麽用?TypeScript concat使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了concat函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

  it('should concat if first source emits once, second source is empty', () => {
    const e1 =   cold('--a--|');
    const e1subs =    '^    !';
    const e2 =   cold(     '--------|');
    const e2subs =    '     ^       !';
    const expected =  '--a----------|';

    expectObservable(e1.pipe(concat(e2))).toBe(expected);
    expectSubscriptions(e1.subscriptions).toBe(e1subs);
    expectSubscriptions(e2.subscriptions).toBe(e2subs);
  });
開發者ID:DallanQ,項目名稱:rxjs,代碼行數:11,代碼來源:concat-spec.ts

示例2: map

 return folders.map(path => MyAppsPanelService.makeTreeNode({
     id: path,
     data: path,
     type: "folder",
     label: AppHelper.getBasename(path),
     isExpanded: this.localExpandedNodes.pipe(
         map(list => list.indexOf(path) !== -1)
     ),
     children: empty().pipe(
         concat(this.fileRepository.watch(path)),
         map(listing => this.createDirectoryListingTreeNodes(listing))
     )
 }));
開發者ID:hmenager,項目名稱:composer,代碼行數:13,代碼來源:my-apps-panel.service.ts

示例3: asDiagram

 asDiagram('timer(3000, 1000)')('should create an observable emitting periodically', () => {
   const e1 = timer(60, 20, rxTestScheduler).pipe(
     take(4), // make it actually finite, so it can be rendered
     concat(NEVER) // but pretend it's infinite by not completing
   );
   const expected = '------a-b-c-d-';
   const values = {
     a: 0,
     b: 1,
     c: 2,
     d: 3,
   };
   expectObservable(e1).toBe(expected, values);
 });
開發者ID:DallanQ,項目名稱:rxjs,代碼行數:14,代碼來源:timer-spec.ts

示例4: fetchFileContent

    fetchFileContent(almostID: string, parse = false): Observable<string> {

        const source = DataGatewayService.getFileSource(almostID);

        if (source === "local") {

            const fetch = empty().pipe(concat(this.ipc.request("getLocalFileContent", almostID)));

            if (parse) {
                return fetch.pipe(
                    map(content => {
                        try {
                            return YAML.safeLoad(content, {json: true, onWarning: noop} as any);
                        } catch (err) {
                            return new Error(err);
                        }
                    })
                );
            }

            return fetch;
        }

        if (source === "app" || source === "public") {

            const fetch = empty().pipe(
                concat(this.ipc.request("getPlatformApp", {id: almostID}))
            );

            if (parse) {
                return fetch.pipe(
                    map(content => JSON.parse(content))
                );
            }
            return fetch;
        }
    }
開發者ID:hmenager,項目名稱:composer,代碼行數:37,代碼來源:data-gateway.service.ts

示例5: it

  it('should retry a synchronous source (multicasted and refCounted) multiple times', (done: MochaDone) => {
    const expected = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3];

    of(1, 2, 3).pipe(
      concat(throwError('bad!')),
      multicast(() => new Subject()),
      refCount(),
      retry(4)
    ).subscribe(
        (x: number) => { expect(x).to.equal(expected.shift()); },
        (err: any) => {
          expect(err).to.equal('bad!');
          expect(expected.length).to.equal(0);
          done();
        }, () => {
          done(new Error('should not be called'));
        });
  });
開發者ID:DallanQ,項目名稱:rxjs,代碼行數:18,代碼來源:retry-spec.ts

示例6: if

        return listing.map(fsEntry => {

            const id    = fsEntry.path;
            const label = AppHelper.getBasename(fsEntry.path);

            let icon           = "fa-folder";
            const iconExpanded = "fa-folder-open";

            if (fsEntry.type === "Workflow") {
                icon = "fa-share-alt";
            } else if (fsEntry.type === "CommandLineTool") {
                icon = "fa-terminal";
            } else if (fsEntry.isFile) {
                icon = "fa-file";
            }

            let children = undefined;

            if (fsEntry.isDir) {
                children = empty().pipe(
                    concat(this.ipc.request("readDirectory", fsEntry.path)),
                    map(list => this.createDirectoryListingTreeNodes(list))
                );
            }

            return MyAppsPanelService.makeTreeNode({
                id,
                icon,
                label,
                children,
                iconExpanded,
                data: fsEntry,
                dragLabel: label,
                dragDropZones: ["graph-editor", "job-editor"],
                isExpandable: fsEntry.isDir,
                dragTransferData: {name: fsEntry.path, type: getDragTransferDataType(fsEntry)},
                type: fsEntry.isDir ? "folder" : "file",
                isExpanded: this.localExpandedNodes.pipe(
                    map(list => list.indexOf(fsEntry.path) !== -1)
                ),
                dragEnabled: true,
                dragImageClass: getDragImageClass(fsEntry)
            });
        });
開發者ID:hmenager,項目名稱:composer,代碼行數:44,代碼來源:my-apps-panel.service.ts


注:本文中的rxjs/operators.concat函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。