-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'timer-redesign' into practice-page
- Loading branch information
Showing
12 changed files
with
323 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,14 @@ | ||
import { TempoTimer } from '$/lib/timer/tick'; | ||
import { getContext, setContext } from 'svelte'; | ||
import Metronome, { | ||
type MetronomeOption, | ||
type OnBarCallback, | ||
type OnBeatCallback | ||
} from './metronome'; | ||
import Metronome from './metronome'; | ||
|
||
const CONTEXT_KEY = 'metronome'; | ||
|
||
export const setMetronomeContext = (option: MetronomeOption) => { | ||
const context = setContext(CONTEXT_KEY, new Metronome(option)); | ||
export const setMetronomeContext = (timer?: TempoTimer) => { | ||
const context = setContext(CONTEXT_KEY, new Metronome(timer ?? new TempoTimer())); | ||
return context; | ||
}; | ||
|
||
export const getMetronomeContext: () => Metronome = () => { | ||
return getContext(CONTEXT_KEY); | ||
}; | ||
|
||
export const onBeat = (cb: OnBeatCallback) => getMetronomeContext().onBeat(cb); | ||
export const onBar = (cb: OnBarCallback) => getMetronomeContext().onBar(cb); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const MAX_TICK_SIZE = 4294967295; |
Oops, something went wrong.