mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 18:31:22 +00:00
65 lines
1.5 KiB
JavaScript
65 lines
1.5 KiB
JavaScript
var ActionTypes = {
|
|
// Connection
|
|
CONNECTION_OPEN: "connection_open",
|
|
CONNECTION_CLOSE: "connection_close",
|
|
CONNECTION_ERROR: "connection_error",
|
|
|
|
// Stores
|
|
SETTINGS_STORE: "settings",
|
|
EVENT_STORE: "events",
|
|
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) {
|
|
|
|
//TODO: Update server.
|
|
|
|
//Facebook Flux: We do an optimistic update on the client already.
|
|
AppDispatcher.dispatchViewAction({
|
|
type: ActionTypes.SETTINGS_STORE,
|
|
cmd: StoreCmds.UPDATE,
|
|
data: 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++
|
|
}
|
|
});
|
|
}
|
|
}; |