summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-03-22 00:54:53 +0100
committerJules Laplace <julescarbon@gmail.com>2018-03-22 00:54:53 +0100
commit8dab62fdfafb24e792bee09a04b5592704f33e92 (patch)
tree9ffe1b28985d33d3e8f7295d08087888ee1575a6 /client
parentd7649bbd11b1d77c017e3275984465e23e618623 (diff)
build
Diffstat (limited to 'client')
-rw-r--r--client/index.js4
-rw-r--r--client/lib/life.js5
2 files changed, 7 insertions, 2 deletions
diff --git a/client/index.js b/client/index.js
index 106053b..d6dad6a 100644
--- a/client/index.js
+++ b/client/index.js
@@ -36,7 +36,9 @@ requestAudioContext( () => {
function play(freq) {
freq.playing = true
instrument.play(freq.frequency)
- freq.div.classList.add('playing')
+ if (instrument === organ || hash || life.isRunning()) {
+ freq.div.classList.add('playing')
+ }
life.assign_item(freq, true)
}
function pause(freq) {
diff --git a/client/lib/life.js b/client/lib/life.js
index 26ff0bf..e5df868 100644
--- a/client/lib/life.js
+++ b/client/lib/life.js
@@ -71,5 +71,8 @@ function fitness (old, score) {
}
return 0
}
+function isRunning() {
+ return !!timeout
+}
-export default { init, step, assign_item, toggle, setTempo } \ No newline at end of file
+export default { init, step, assign_item, toggle, setTempo, isRunning } \ No newline at end of file