import { Modeler } from 'redux-aggregate' ; export interface CounterST { name : string ; count : number ; todoCount : number ; now : string ; bgColor : string ; } export const CounterModel = injects => ( { name : '' , count : 0 , todoCount : 0 , now : '' , bgColor : '#fff' , ... injects } ) ; function getCount ( state ) { return state . count ; } function expo2 ( state ) { return state . count ** 2 ; } function getCountSum ( state ) { return state . count + state . todoCount ; } export const CounterQR = { getCount , expo2 , getCountSum } ; function increment ( state ) { return { ... state , count : state . count + 1 } ; } function decrement ( state ) { return { ... state , count : state . count - 1 } ; } function setTodoCount ( state , todoCount ) { return { ... state , todoCount } ; } export const CounterMT = { increment , decrement , setTodoCount } ; const Timer = { tick ( state , timeLabel ) { return { ... state , now : timeLabel } ; } } ; export const CounterSB = { Timer } ;