var todoActions = {
createTodo: function(text) {
AppDispatcher.dispatch({
type: 'create_todo',
data: {
...
}
});
//----Maybe-----
utils.sendToServer(text);
}
deleteTodo: function(id) {
...
}
}
ActionTypes = keyMirror({
CREATE_TODO: null,
DELETE_TODO: null,
ASIGN_TODO: null,
DELETE_FINISHED: null
});
var todoActions = {
createTodo: function(text) {
AppDispatcher.dispatch({
type: ActionTypes.CREATE_TODO,
data: {
...
}
});
//----Maybe-----
utils.sendToServer(text);
}
function TodoStore() {
...
this.dispatchToken = AppDispatcher.register(function (action) {
switch (action.actionType) {
case actionTypes.CLICK_TODO:
AppDispatcher.waitFor([
subItemsStore.dispatchToken,
commentsStore.dispatchToken
]);
break;
}
}
}