本文整理汇总了TypeScript中base.Store.dispatch方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Store.dispatch方法的具体用法?TypeScript Store.dispatch怎么用?TypeScript Store.dispatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类base.Store
的用法示例。
在下文中一共展示了Store.dispatch方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: 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));
}
示例2: 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));
}
示例3: 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]);
}
示例4: onClickResult
onClickResult() {
this.store.dispatch(this.calculatorActions.result());
}
示例5: onClickDecimal
onClickDecimal() {
this.store.dispatch(this.calculatorActions.inputDecimal());
}
示例6: onClickNumber
onClickNumber(value: any) {
this.store.dispatch(this.calculatorActions.inputNumber(value));
}