soiz1 commited on
Commit
5d1a679
·
verified ·
1 Parent(s): 743269a

Create src/addons/addons/waveform-chunk-size/userscript.js

Browse files
src/addons/addons/waveform-chunk-size/userscript.js ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export default async function ({ addon }) {
2
+ let chunkSize = addon.settings.get("quality");
3
+ const updateChunkSize = () => {
4
+ ReduxStore.dispatch({
5
+ type: 'scratch-gui/addon-util/SET_SOUND_EDITOR_WAVEFORM_CHUNK_SIZE',
6
+ chunkSize: chunkSize
7
+ });
8
+ };
9
+
10
+ updateChunkSize();
11
+ addon.self.addEventListener("disabled", () => {
12
+ chunkSize = 1024;
13
+ updateChunkSize();
14
+ });
15
+ addon.self.addEventListener("reenabled", () => {
16
+ chunkSize = addon.settings.get("quality");
17
+ updateChunkSize();
18
+ });
19
+ }