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