improve code init logic

This commit is contained in:
Felix Roos 2023-12-11 22:17:10 +01:00
parent faaed61384
commit 853a31b638
2 changed files with 7 additions and 6 deletions

View file

@ -36,6 +36,11 @@ export function getActivePattern() {
export function useActivePattern() {
return useStore($activePattern);
}
export function initUserCode(code) {
const userPatterns = getUserPatterns();
const match = Object.entries(userPatterns).find(([_, pat]) => pat.code === code);
setActivePattern(match?.[0] || '');
}
export function useSettings() {
const state = useStore(settingsMap);