当前位置: 首页>>代码示例>>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;未经允许,请勿转载。