Skip to content

Instantly share code, notes, and snippets.

@binaryta
Created February 25, 2018 15:40
Show Gist options
  • Save binaryta/21c8ffe9079deb1b6de5778c959a0d72 to your computer and use it in GitHub Desktop.
Save binaryta/21c8ffe9079deb1b6de5778c959a0d72 to your computer and use it in GitHub Desktop.
import { ActionsType, ActionResult } from "hyperapp"
import { State } from "./state"
export interface Actions {
down: (value: number) => (state: State) => ActionResult<State>;
up: (value: number) => (state: State) => ActionResult<State>;
}
export const actions: ActionsType<State, Actions> = {
down: (value: number) => (state) => {
return { count: state.count - value }
},
up: (value: number) => (state) => {
return { count: state.count + value }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment