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


TypeScript Store.take方法代码示例

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


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

示例1: hmrOnDestroy

 hmrOnDestroy(store) {
   const cmpLocation = this.appRef.components.map(cmp => cmp.location.nativeElement);
   this._store.take(1).subscribe(s => store.rootState = s);
   store.disposeOldHosts = createNewHosts(cmpLocation);
   store.restoreInputValues = createInputTransfer();
   removeNgStyles();
 }
开发者ID:Ecafracs,项目名称:flatthirteen,代码行数:7,代码来源:app.module.ts

示例2: initModifyPaymentData

 initModifyPaymentData(): void {
     this.store.take(1).subscribe(store => {
       let relationshipId = store.selectedproperty.relationshipId;
       let modifiedData = _.cloneDeep(store.modifypayment.paymentInfo);
       modifiedData.relationshipId = relationshipId;
       this.store.dispatch(new paymentHistoryTypes.ModifyPayment(modifiedData));
     });
 }
开发者ID:bbachi,项目名称:Angular5Sample,代码行数:8,代码来源:modifypayment.resolver.ts

示例3: incrementIfOdd

 incrementIfOdd() {
   this.store.take(1)
     .subscribe(({ counter }) => {
       if (counter % 2 !== 0) {
         this.store.dispatch({ type: INCREMENT_COUNTER });
       }
     });
 }
开发者ID:ShivKamal,项目名称:ngCourse2,代码行数:8,代码来源:counter-actions.ts

示例4: castIfOdd

 castIfOdd() {
   this.store.take(1)
     .subscribe(({ curse }) => {
       if (curse % 2 !== 0) {
         this.store.dispatch({ type: CAST_CURSE });
       }
     });
 }
开发者ID:ShivKamal,项目名称:ngCourse2,代码行数:8,代码来源:curse-actions.ts

示例5: it

    it(`should should use config.reducerFactory`, () => {
      store.dispatch({ type: 'fruit', payload: 'banana' });
      store.dispatch({ type: 'a', payload: 42 });

      store.take(1).subscribe((s: any) => {
        expect(s).toEqual({
          fruit: 'banana',
          a: 4,
        });
      });
    });
开发者ID:WinGood,项目名称:platform,代码行数:11,代码来源:modules.spec.ts

示例6: syncToServer

 syncToServer() {
   this.store.take(1).subscribe(appState => {
     appState.notes.forEach(note => {
       if (note.dirty === true) {
         this.notesDataService.updateNote(note).subscribe(note => {
           this.store.dispatch({ type: "UPDATE_NOTE_FROM_SERVER", payload: { note } });
         });
       }
     });      
   });
 }
开发者ID:JavascriptMick,项目名称:ng2-state-demo,代码行数:11,代码来源:notes.service.server_first_on_add.ts

示例7: hmrOnDestroy

 public hmrOnDestroy(store: StoreType) {
   const cmpLocation = this.appRef.components.map((cmp) => cmp.location.nativeElement);
   // save state
   this._store.take(1).subscribe(s => store.rootState = s);
   // recreate root elements
   store.disposeOldHosts = createNewHosts(cmpLocation);
   // save input values
   store.restoreInputValues  = createInputTransfer();
   // remove styles
   removeNgStyles();
 }
开发者ID:greg9504,项目名称:angular-electron-dream-starter,代码行数:11,代码来源:app.module.ts

示例8: getFlows

  private getFlows(exceptFlowId: number): IFlow[]
  {
    let state: IAppState;
    this.store.take(1).subscribe(s => state = s);

    const flows: IFlow[] = state.scene.flows
      .filter((fh, index) => fh.present.id !== exceptFlowId)
      .map(fh => fh.present);

    return flows;
  }
开发者ID:twop,项目名称:SlopFlow.Editor,代码行数:11,代码来源:dialog.service.ts

示例9: syncToServer

 syncToServer() {
   this.store.take(1).subscribe(appState => {
     appState.notes.forEach(note => {
       if (note.dirty === true) {
         //json-server accepts a Post for a pre-existing id and updates it in place
         this.notesDataService.addNote(note).subscribe(note => {
           this.store.dispatch({ type: "UPDATE_NOTE_FROM_SERVER", payload: { note } });
         });
       }
     })
   });
 }
开发者ID:JavascriptMick,项目名称:ng2-state-demo,代码行数:12,代码来源:notes.service.store_first_on_add.ts

示例10: initSubmitPaymentData

 initSubmitPaymentData(): void {
     this.store.take(1).subscribe(store => {
       try{
         let relationshipId = store.selectedproperty.relationshipId;
         let bpName = store.selectedproperty.selectedProperty.bpName;
         let email = store.loggedinuser.loggedInUser.email;
         let payment = store.billing.payment;
         this.store.dispatch(new billingTypes.SubmitPayment({bpName,email,relationshipId,payment}));
       }catch(err){
           console.log("error===initSubmitPaymentData>>>>"+err.message)
       }
   });
 }
开发者ID:bbachi,项目名称:Angular5Sample,代码行数:13,代码来源:submitpayment.resolver.ts


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