diff options
author | neauoire <[email protected]> | 2019-11-24 15:58:04 -0500 |
---|---|---|
committer | neauoire <[email protected]> | 2019-11-24 15:58:04 -0500 |
commit | 4fd9ad72aafbb3f0c71139fd36ae421f1d8f352a (patch) | |
tree | c88df89e909bc69629fec5d6d5c76ab70104762e /desktop/sources/scripts/clock.js | |
parent | 3e661692b1d83913b1d78d7ab49a0c000d4cc0c5 (diff) | |
download | Orca-4fd9ad72aafbb3f0c71139fd36ae421f1d8f352a.tar.gz Orca-4fd9ad72aafbb3f0c71139fd36ae421f1d8f352a.zip |
Breaking changes to BFL
Diffstat (limited to 'desktop/sources/scripts/clock.js')
-rw-r--r-- | desktop/sources/scripts/clock.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/desktop/sources/scripts/clock.js b/desktop/sources/scripts/clock.js index a7351d8..d1aab0a 100644 --- a/desktop/sources/scripts/clock.js +++ b/desktop/sources/scripts/clock.js @@ -3,7 +3,8 @@ /* global Blob */ function Clock (client) { - const worker = 'onmessage = (e) => { setInterval(() => { postMessage(true) }, e.data)}' + const workerScript = 'onmessage = (e) => { setInterval(() => { postMessage(true) }, e.data)}' + const worker = window.URL.createObjectURL(new Blob([workerScript], { type: 'text/javascript' })) this.isPaused = true this.timer = null @@ -52,6 +53,7 @@ function Clock (client) { } else { this.stop(msg) } + client.update() } this.play = function (msg = false) { @@ -65,7 +67,7 @@ function Clock (client) { this.stop = function (msg = false) { console.log('Clock', 'Stop') - if (this.isPaused === true) { console.warn('Clock', 'Already stopped'); return } + if (this.isPaused === true) { return } if (this.isPuppet === true) { console.warn('Clock', 'External Midi control'); return } this.isPaused = true if (msg === true) { client.io.midi.sendClockStop() } @@ -112,7 +114,7 @@ function Clock (client) { if (bpm < 60) { console.warn('Clock', 'Error ' + bpm); return } this.clearTimer() window.localStorage.setItem('bpm', bpm) - this.timer = new Worker(window.URL.createObjectURL(new Blob([worker], { type: 'text/javascript' }))) + this.timer = new Worker(worker) this.timer.postMessage((60000 / parseInt(bpm)) / 4) this.timer.onmessage = (event) => { client.io.midi.sendClock() |