本文整理汇总了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();
}
示例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));
});
}
示例3: incrementIfOdd
incrementIfOdd() {
this.store.take(1)
.subscribe(({ counter }) => {
if (counter % 2 !== 0) {
this.store.dispatch({ type: INCREMENT_COUNTER });
}
});
}
示例4: castIfOdd
castIfOdd() {
this.store.take(1)
.subscribe(({ curse }) => {
if (curse % 2 !== 0) {
this.store.dispatch({ type: CAST_CURSE });
}
});
}
示例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,
});
});
});
示例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 } });
});
}
});
});
}
示例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();
}
示例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;
}
示例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 } });
});
}
})
});
}
示例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)
}
});
}