/
ChartViewActions.js
93 lines (83 loc) · 1.92 KB
/
ChartViewActions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/* Flux dispatcher */
var Dispatcher = require("../dispatcher/dispatcher");
/**
* ### ChartViewActions
* Send data from React views to Flux dispatcher, and on to the stores
*/
var ChartViewActions = {
/**
* Update all chart props
* @param {Object} - `chartProps`
*/
updateAllChartProps: function(newChartProps) {
Dispatcher.handleViewAction({
eventName: "update-all-chart-props",
chartProps: newChartProps
});
},
/**
* Update a single chart prop
* @param {string} key - The key used to identify this property
* @param {object} newProp - The property's value
*/
updateChartProp: function(key, newProp) {
Dispatcher.handleViewAction({
eventName: "update-chart-prop",
key: key,
newProp: newProp
});
},
/**
* Update a single chart prop and reparse the input
* @param {string} key - The key used to identify this property
* @param {object} newProp - The property's value
*/
updateAndReparse: function(key, newProp) {
Dispatcher.handleViewAction({
eventName: "update-and-reparse",
newProp: newProp,
key: key
});
},
/**
* Update a data input and reparse it
* @param {string} key - The key used to identify this property
* @param {object} newInput - The property's value
*/
updateInput: function(key, newInput) {
Dispatcher.handleViewAction({
eventName: "update-data-input",
newProp: newInput,
key: key
});
},
/**
* Update metadata
* @param {object} newMetadata - The property's value
*/
updateMetadata: function(k, v) {
Dispatcher.handleViewAction({
eventName: "update-metadata",
key: k,
value: v
});
},
updateSession: function(k, v) {
Dispatcher.handleViewAction({
eventName: "update-session",
key: k,
value: v
})
},
startTimer: function() {
Dispatcher.handleViewAction({
eventName: "start-timer"
});
},
stopTimer: function() {
Dispatcher.handleViewAction({
eventName: "stop-timer"
});
},
};
module.exports = ChartViewActions;