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


TypeScript Observable.connect方法代码示例

本文整理汇总了TypeScript中rxjs/Observable.Observable.connect方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Observable.connect方法的具体用法?TypeScript Observable.connect怎么用?TypeScript Observable.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rxjs/Observable.Observable的用法示例。


在下文中一共展示了Observable.connect方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: getVersionInfo

 private getVersionInfo(navigationInfo: Observable<NavigationResponse>) {
   const versionInfo = navigationInfo
     .map(response => response.__versionInfo)
     .publishLast();
   versionInfo.connect();
   return versionInfo;
 }
开发者ID:maxisam,项目名称:angular,代码行数:7,代码来源:navigation.service.ts

示例2: getSelectedNodes

 /**
  * Get an observable that will list the nodes that are currently selected
  * We use `publishReplay(1)` because otherwise subscribers will have to wait until the next
  * URL change before they receive an emission.
  * See above for discussion of using `connect`.
  */
 private getSelectedNodes(navigationViews: Observable<NavigationViews>) {
   const selectedNodes = combineLatest(
     navigationViews.map(this.computeUrlToNodesMap),
     this.location.currentUrl,
     (navMap, url) => navMap[url] || [])
     .publishReplay(1);
   selectedNodes.connect();
   return selectedNodes;
 }
开发者ID:JohnnyQQQQ,项目名称:angular,代码行数:15,代码来源:navigation.service.ts

示例3: getCategories

  private getCategories(): Observable<Category[]> {

    const categories = this.http.get<any>(resourcesPath)
      .map(data => mkCategories(data))
      .publishLast();

    categories.connect();
    return categories;
  };
开发者ID:AnthonyPAlicea,项目名称:angular,代码行数:9,代码来源:resource.service.ts

示例4: getNavigationViews

 private getNavigationViews(navigationInfo: Observable<NavigationResponse>): Observable<NavigationViews> {
   const navigationViews = navigationInfo.map(response => {
     const views: NavigationViews = Object.assign({}, response);
     Object.keys(views).forEach(key => {
       if (key[0] === '_') { delete views[key]; }
     });
     return views;
   }).publishReplay(1);
   navigationViews.connect();
   return navigationViews;
 }
开发者ID:diestrin,项目名称:angular,代码行数:11,代码来源:navigation.service.ts

示例5: getCurrentNode

 /**
  * Get an observable of the current node (the one that matches the current URL)
  * We use `publishReplay(1)` because otherwise subscribers will have to wait until the next
  * URL change before they receive an emission.
  * See above for discussion of using `connect`.
  */
 private getCurrentNode(navigationViews: Observable<NavigationViews>): Observable<CurrentNode> {
   const currentNode = combineLatest(
     navigationViews.map(this.computeUrlToNavNodesMap),
     this.location.currentPath,
     (navMap, url) => {
       const urlKey = url.startsWith('api/') ? 'api' : url;
       return navMap[urlKey] || { view: '', url: urlKey, nodes: [] };
     })
     .publishReplay(1);
   currentNode.connect();
   return currentNode;
 }
开发者ID:lucidsoftware,项目名称:angular,代码行数:18,代码来源:navigation.service.ts

示例6: getCurrentNodes

  /**
   * Get an observable of the current nodes (the ones that match the current URL)
   * We use `publishReplay(1)` because otherwise subscribers will have to wait until the next
   * URL change before they receive an emission.
   * See above for discussion of using `connect`.
   */
  private getCurrentNodes(navigationViews: Observable<NavigationViews>): Observable<CurrentNodes> {
    const currentNodes = combineLatest(
      navigationViews.map(views => this.computeUrlToNavNodesMap(views)),
      this.location.currentPath,

      (navMap, url) => {
        const urlKey = url.startsWith('api/') ? 'api' : url;
        return navMap.get(urlKey) || { '' : { view: '', url: urlKey, nodes: [] }};
      })
      .publishReplay(1);
    currentNodes.connect();
    return currentNodes;
  }
开发者ID:cironunes,项目名称:angular,代码行数:19,代码来源:navigation.service.ts

示例7: getContributors

  private getContributors() {
    const contributors = this.http.get(contributorsPath)
      .map(res => res.json())

      // Create group map
      .map(contribs => {
        const contribMap = new Map<string, Contributor[]>();
        Object.keys(contribs).forEach(key => {
          const contributor = contribs[key];
          const group = contributor.group;
          const contribGroup = contribMap[group];
          if (contribGroup) {
            contribGroup.push(contributor);
          } else {
            contribMap[group] = [contributor];
          }
        });

        return contribMap;
      })

      // Flatten group map into sorted group array of sorted contributors
      .map(cmap => {
        return Object.keys(cmap).map(key => {
          const order = knownGroups.indexOf(key);
          return {
            name: key,
            order: order === -1 ? knownGroups.length : order,
            contributors: cmap[key].sort(compareContributors)
          } as ContributorGroup;
        })
        .sort(compareGroups);
      })
      .publishLast();

    contributors.connect();
    return contributors;
  }
开发者ID:fmalcher,项目名称:angular-cli,代码行数:38,代码来源:contributor.service.ts

示例8: getContributors

  private getContributors() {
    const contributors = this.http.get(contributorsPath)
      .map(res => res.json())
      .map(contribs => {
        const contribGroups = new Map<string, Contributor[]>();

        Object.keys(contribs).forEach(key => {
          const contributor = contribs[key];
          const group = contributor.group;
          const contribGroup = contribGroups[group];
          if (contribGroup) {
            contribGroup.push(contributor);
          } else {
            contribGroups[group] = [contributor];
          }
        });

        return contribGroups;
      })
      .publishLast();
    contributors.connect();
    return contributors;
  }
开发者ID:jiw0220,项目名称:jigsaw,代码行数:23,代码来源:contributor.service.ts

示例9: getNavigationViews

 private getNavigationViews(navigationInfo: Observable<NavigationResponse>): Observable<NavigationViews> {
   const navigationViews = navigationInfo.map(response => unpluck(response, '__versionInfo')).publishReplay(1);
   navigationViews.connect();
   return navigationViews;
 }
开发者ID:lucidsoftware,项目名称:angular,代码行数:5,代码来源:navigation.service.ts


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