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