aboutsummaryrefslogtreecommitdiff
path: root/src/view/play.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/view/play.ts')
-rw-r--r--src/view/play.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/view/play.ts b/src/view/play.ts
index b85e505..4abc4ec 100644
--- a/src/view/play.ts
+++ b/src/view/play.ts
@@ -1,4 +1,4 @@
-import { h, withVar, Html } from 'lib/rx'
+import { h, withState, Html } from 'lib/rx'
import * as Options from 'view/options'
import * as Chord from 'chord'
@@ -9,19 +9,19 @@ interface ViewParams {
export function view({ options }: ViewParams): Html {
const initChords: Array<[string, string]> = [['', ''], Chord.generate(options), Chord.generate(options)]
- return withVar(initChords, (chords, updateChords) =>
- withVar(undefined, (beat, updateBeat) => {
+ return withState(initChords, chords =>
+ withState(undefined, beat => {
let chordBeat = 1
const interval = setInterval(() => {
if (chordBeat === options.beatsPerChord) {
- updateChords(xs => {
+ chords.update(xs => {
xs.shift()
xs.push(Chord.generate(options))
return xs
})
chordBeat = 1
} else {
- updateBeat(_ => undefined)
+ beat.update(_ => undefined)
chordBeat += 1
}
}, 60 / options.bpm * 1000)