var ActionTypes = { // Connection CONNECTION_OPEN: "connection_open", CONNECTION_CLOSE: "connection_close", CONNECTION_ERROR: "connection_error", // Settings UPDATE_SETTINGS: "update_settings", // EventLog EVENT_STORE: "events", ADD_EVENT: "add_event", // Flow FLOW_STORE: "flows", }; var StoreCmds = { ADD: "add", UPDATE: "update", REMOVE: "remove", RESET: "reset" }; var ConnectionActions = { open: function () { AppDispatcher.dispatchViewAction({ type: ActionTypes.CONNECTION_OPEN }); }, close: function () { AppDispatcher.dispatchViewAction({ type: ActionTypes.CONNECTION_CLOSE }); }, error: function () { AppDispatcher.dispatchViewAction({ type: ActionTypes.CONNECTION_ERROR }); } }; var SettingsActions = { update: function (settings) { settings = _.merge({}, SettingsStore.getAll(), settings); //TODO: Update server. //Facebook Flux: We do an optimistic update on the client already. AppDispatcher.dispatchViewAction({ type: ActionTypes.UPDATE_SETTINGS, settings: settings }); } }; var EventLogActions_event_id = 0; var EventLogActions = { add_event: function (message) { AppDispatcher.dispatchViewAction({ type: ActionTypes.EVENT_STORE, cmd: StoreCmds.ADD, data: { message: message, level: "web", id: "viewAction-" + EventLogActions_event_id++ } }); } };