Skip to content

Instantly share code, notes, and snippets.

@webrune-tim
Created January 30, 2017 20:18
Show Gist options
  • Select an option

  • Save webrune-tim/9e2bd7aaecea89f60b1ae7f0e4e4c2d7 to your computer and use it in GitHub Desktop.

Select an option

Save webrune-tim/9e2bd7aaecea89f60b1ae7f0e4e4c2d7 to your computer and use it in GitHub Desktop.
import dispatcher from "../dispatcher";
export function addTodo(text) {
dispatcher.dispatch({
type: "ADD_TODO",
text,
});
}
export function deleteTodo(todoToDelete) {
dispatcher.dispatch({
type: 'DELETE_TODO',
todoToDelete,
});
}
export function toggleShowCompletedTodos() {
dispatcher.dispatch({
type: 'TOGGLE_SHOW_COMPLETED_TODOS'
})
}
export function toggleShowIncompletedTodos() {
dispatcher.dispatch({
type: 'TOGGLE_SHOW_INCOMPLETED_TODOS'
})
}
export function toggleTodo(todo) {
dispatcher.dispatch({
type: 'TOGGLE_TODO',
todo,
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment