generated from nhcarrigan/template
23 lines
715 B
TypeScript
23 lines
715 B
TypeScript
import { derived } from "svelte/store";
|
|
import { configStore } from "./config";
|
|
import { soundPlayer } from "$lib/notifications";
|
|
|
|
// Sync notification settings with config
|
|
export const notificationSettings = derived(configStore.config, ($config) => {
|
|
soundPlayer.setEnabled($config.notifications_enabled);
|
|
soundPlayer.setGlobalVolume($config.notification_volume);
|
|
|
|
return {
|
|
enabled: $config.notifications_enabled,
|
|
volume: $config.notification_volume,
|
|
};
|
|
});
|
|
|
|
// Helper to update notification settings
|
|
export async function updateNotificationSettings(enabled: boolean, volume: number) {
|
|
await configStore.updateConfig({
|
|
notifications_enabled: enabled,
|
|
notification_volume: volume,
|
|
});
|
|
}
|