-
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.
- Loading branch information
Showing
23 changed files
with
623 additions
and
777 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,6 @@ pnpm-debug.log* | |
lerna-debug.log* | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
.idea | ||
*.suo | ||
*.ntvs* | ||
|
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,6 @@ | ||
{ | ||
"recommendations": [ | ||
"svelte.svelte-vscode", | ||
"bradlc.vscode-tailwindcss" | ||
] | ||
} |
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 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 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
Oops, something went wrong.