diff options
author | Joris | 2023-02-19 14:39:02 +0100 |
---|---|---|
committer | Joris | 2023-02-19 14:39:02 +0100 |
commit | e0699eed72c5682bd2395ba4299ff69933c83d48 (patch) | |
tree | b5601a32492b70ec9458738a64bac6d6e15802cc /src/view/play.ts | |
parent | bb058d35c7110dcffe31b4e7afabbe26673a43a8 (diff) |
Diffstat (limited to 'src/view/play.ts')
-rw-r--r-- | src/view/play.ts | 10 |
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) |