Spaces:
Build error
Build error
Create src/reducers/addon-util.js
Browse files- src/reducers/addon-util.js +30 -0
src/reducers/addon-util.js
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const SET_SOUND_EDITOR_WAVEFORM_CHUNK_SIZE = 'scratch-gui/addon-util/SET_SOUND_EDITOR_WAVEFORM_CHUNK_SIZE';
|
2 |
+
|
3 |
+
const initialState = {
|
4 |
+
soundEditorWaveformChunkSize: 1024,
|
5 |
+
};
|
6 |
+
|
7 |
+
const reducer = function (state, action) {
|
8 |
+
if (typeof state === 'undefined') state = initialState;
|
9 |
+
switch (action.type) {
|
10 |
+
case SET_SOUND_EDITOR_WAVEFORM_CHUNK_SIZE:
|
11 |
+
return {
|
12 |
+
soundEditorWaveformChunkSize: action.chunkSize
|
13 |
+
};
|
14 |
+
default:
|
15 |
+
return state;
|
16 |
+
}
|
17 |
+
};
|
18 |
+
|
19 |
+
const setSoundEditorWaveformChunkSize = function (chunkSize) {
|
20 |
+
return {
|
21 |
+
type: SET_SOUND_EDITOR_WAVEFORM_CHUNK_SIZE,
|
22 |
+
chunkSize: chunkSize
|
23 |
+
};
|
24 |
+
};
|
25 |
+
|
26 |
+
export {
|
27 |
+
reducer as default,
|
28 |
+
initialState as addonUtilInitialState,
|
29 |
+
setSoundEditorWaveformChunkSize
|
30 |
+
};
|