Files
llink/js/src/stores/autoplay-store.ts
T
Arjun PatelandGitHub 3de3ca7cef setup electron multi-window architecture (#102)
* prototype with two windows

* use deps in separate window render process

* enhance autoplay into desktop overlay

* fix: autoplay window not applying tailwind styles
2026-03-31 15:05:59 -07:00

36 lines
720 B
TypeScript

import { create } from "zustand";
const STORAGE_KEY = "llink:autoplay-muted";
function loadMuted(): boolean {
try {
return localStorage.getItem(STORAGE_KEY) === "true";
} catch {
return false;
}
}
function saveMuted(muted: boolean) {
try {
localStorage.setItem(STORAGE_KEY, String(muted));
} catch {
// Storage unavailable
}
}
interface AutoplayState {
/** When true, incoming play requests are ignored */
muted: boolean;
/** Toggle muted state */
toggleMuted: () => void;
}
export const useAutoplayStore = create<AutoplayState>((set, get) => ({
muted: loadMuted(),
toggleMuted: () => {
const next = !get().muted;
set({ muted: next });
saveMuted(next);
},
}));