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


TypeScript Observable.combineLatest方法代码示例

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


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

示例1: asObservable

 asObservable(): Observable<MessageSetting> {
     return Observable.combineLatest(
         this._showJoin.asObservable(),
         this._showPart.asObservable(),
         this._showMode.asObservable(),
         this._showMotd.asObservable(),
         this._showNickChange.asObservable(),
         this._showQuit.asObservable(),
         (showJoin, showPart, showMode, showMotd, showNickChange, showQuit) => {
             return {
                 showJoin,
                 showPart,
                 showMode,
                 showMotd,
                 showNickChange,
                 showQuit,
             };
         }
     );
 }
开发者ID:karen-irc,项目名称:karen,代码行数:20,代码来源:GeneralSettingViewModel.ts

示例2:

 .mergeMap(l => {
     const vendors: Observable<{ item: any, vendors: Vendor[] }>[] = [];
     this.forEachItem(list, item => {
         const related = this.getRelated(data, item.id);
         if (related !== undefined && related.vendors !== undefined) {
             vendors.push(this.getVendors(related).map(ts => {
                 return {item: item, vendors: ts};
             }));
         }
     });
     if (vendors.length > 0) {
         return Observable.combineLatest(...vendors, (...pvendors) => {
             pvendors.forEach(v => {
                 v.item.vendors = v.vendors;
             });
             return l;
         });
     } else {
         return Observable.of(l);
     }
 })
开发者ID:aluink,项目名称:ffxiv-teamcraft,代码行数:21,代码来源:list-manager.service.ts

示例3: it

 it('should make multiple user event Observables', function (done) {
   const userEvents = mockDOMSource({
     '.foo': {
       'click': Observable.of(135),
     },
     '.bar': {
       'scroll': Observable.of(2),
     },
   });
   Observable.combineLatest(
     userEvents.select('.foo').events('click'),
     userEvents.select('.bar').events('scroll'),
     (a: number, b: number) => a * b,
   ).subscribe({
     next: ev => {
       assert.strictEqual(ev, 270);
       done();
     },
     error: err => done(err),
     complete: () => {},
   });
 });
开发者ID:whitecolor,项目名称:cyclejs,代码行数:22,代码来源:mock-dom-source.ts

示例4: ngOnInit

  ngOnInit() {
    
    let filterTodos = (val: boolean) => (item: Todo) => item.completed === val;

    this.hideCompleted$ = this.ngRedux.select(state => {
      
      return !state.filter.showCompleted;
    });

    this.todos$ = this.ngRedux
      .select(n => n.todos);

    this.completedTodos$ = this.todos$
      .map(todos => todos.filter(filterTodos(true)));

    this.incompleteTodos$ = this.todos$
      .map(todos => todos.filter(filterTodos(false)));

    this.total$ = this.todos$.pluck('length');
    this.completed$ = this.completedTodos$.pluck('length');

    this.filteredTodos$ = this.todos$
      .combineLatest(this.hideCompleted$, (todos, filter) => {
        return todos.filter(n => filterTodos(false)(n) || filter === false);
      });

    this.ngRedux.mapDispatchToTarget({
      completeTodo,
      editTodo,
      deleteTodo,
      filterCompleted,
      completeAll,
      clearCompleted,
      addTodo
    })(this);

  }
开发者ID:e-schultz,项目名称:angular2-redux-example,代码行数:37,代码来源:todo-page.ts

示例5: constructor

  constructor(router: Router, zone: NgZone) {
    if (typeof prebootstrap === 'undefined') {
      return;
    }

    const finished = Observable.combineLatest(router.events, zone.onMicrotaskEmpty);

    const subscription = finished.subscribe(([event, stable]) => {
      if (stable === false) {
        return;
      }

      switch (true) {
        case event instanceof NavigationError:
        case event instanceof NavigationEnd:
          setImmediate(() => prebootClient().complete());

          subscription.unsubscribe();
          break;
        default:
          break;
      }
    });
  }
开发者ID:sonukapoor,项目名称:angular-ssr,代码行数:24,代码来源:root.module.ts

示例6:

export const constructedPlaylistItem = (store: any) => Observable
    .combineLatest(store.let(playlistSelector),
                   store.let(artistSelector),
                   store.let(audioSelector),
                   store.let(playlistArraySelector))
    .map((res: any) => {
        console.log("[playlist.selector] --constructedPlaylistItem- playlistArraySelector --res[0] ", res[0]);
         // console.log("[playlist.selector] --constructedPlaylistItem- artistSelector --res[1] ", res[1]);
         // console.log("[playlist.selector] --constructedPlaylistItem- audioSelector --res[2] ", res[2]);

        var playlist =  Object.assign({}, res[0]);
        console.log("[playlist.selector] --constructedPlaylistItem- playlistArraySelector --res[0].length "+ res[0].length);
        console.log("[playlist.selector] --constructedPlaylistItem- playlistArraySelector --playlist.audioList.length = "+ playlist.audioList.length);

        if(playlist.audioList.length>0 ){
            var artistAudioItem =  Object.keys(res[1]) .filter( x =>  {
                                      return res[1][x].id  ===  res[2].artistId})
                                     .map(x => {return res[1][x]})[0];

            var newResult = Object.keys(playlist.audioList).map(key => ({key:key, playlistItem:playlist.audioList[key]})).map( value =>{
              // obj = res[0][value.key];
              console.log("playlist.selector] --constructedPlaylistItem --value ",value);
               console.log("playlist.selector] --constructedPlaylistItem --value.playlistItem.artistId", value.playlistItem.artistId);
             // console.log("playlist.selector] --constructedPlaylistItem --artistAudioItem.id", artistAudioItem.id);
               if(value.playlistItem.artistId === artistAudioItem.id){
                  playlist.audioList[value.key] =  Object.assign({}, value.playlistItem, {artist:artistAudioItem} );
                  //console.log("playlist.selector] --constructedPlaylistItem --   playList[value.key] =",  playList[value.key]);
               }
            });
            console.log("playlist.selector] --constructedPlaylistItem --valueer --playlist.audioList ", playlist.audioList);
            return playlist.audioList;
        }else{
        console.log("[playlist.selector] -- constructedPlaylistItem -- DEFAULT");
           return res[3];
        }
    });
开发者ID:willSonic,项目名称:angular2-exp-ngrx,代码行数:36,代码来源:playlist.selector.ts


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