本文整理匯總了TypeScript中base.Store類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Store類的具體用法?TypeScript Store怎麽用?TypeScript Store使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Store類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: hmrOnDestroy
hmrOnDestroy(store) {
const cmpLocation = this.appRef.components.map(cmp => cmp.location.nativeElement);
this.store.first().subscribe(s => store.rootState = s);
store.disposeOldHosts = createNewHosts(cmpLocation);
store.restoreInputValues = createInputTransfer();
removeNgStyles();
}
示例2: onClickOperation
onClickOperation(value: any) {
let actionType: any;
switch (value) {
case 'C': actionType = ActionTypes.CLEAN; break;
case '+/-': actionType = ActionTypes.CHANGE_SIGN; break;
case '%': actionType = ActionTypes.PERCENT; break;
default: break;
}
this.store.dispatch(this.calculatorActions.inputOperation(actionType));
}
示例3: onClickOperator
onClickOperator(operator: any) {
let actionType: any;
switch (operator) {
case 'รท': actionType = ActionTypes.DIVIDE; break;
case 'x': actionType = ActionTypes.MULTIPLY; break;
case '-': actionType = ActionTypes.SUBSTRACT; break;
case '+': actionType = ActionTypes.SUM; break;
default: break;
}
this.store.dispatch(this.calculatorActions.inputOperator(actionType));
}
示例4: hmrOnInit
hmrOnInit(store) {
console.log('[BASE] Restoring State...');
if (!store || !store.rootState) return;
if (store.rootState) {
this.store.dispatch(
{ type: 'SET_ROOT_STATE', payload: store.rootState }
);
}
if ('restoreInputValues' in store) { store.restoreInputValues(); }
this.appRef.tick();
Object.keys(store).forEach(prop => delete store[prop]);
}
示例5: onClickResult
onClickResult() {
this.store.dispatch(this.calculatorActions.result());
}
示例6: onClickDecimal
onClickDecimal() {
this.store.dispatch(this.calculatorActions.inputDecimal());
}
示例7: onClickNumber
onClickNumber(value: any) {
this.store.dispatch(this.calculatorActions.inputNumber(value));
}