Compare commits
2 Commits
2ec029cd16
...
d27e780f35
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d27e780f35 | ||
| d2a2f0ceea |
@ -30,10 +30,16 @@ function App() {
|
|||||||
const setTheme = (theme: string) => {
|
const setTheme = (theme: string) => {
|
||||||
_setTheme(theme);
|
_setTheme(theme);
|
||||||
localStorage.setItem("theme", theme);
|
localStorage.setItem("theme", theme);
|
||||||
|
bc.postMessage(theme);
|
||||||
};
|
};
|
||||||
const [toasts, setToasts] = useState<ToastMessage[]>([]);
|
const [toasts, setToasts] = useState<ToastMessage[]>([]);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
|
const bc = new BroadcastChannel("theme-channel");
|
||||||
|
bc.onmessage = (ev) => {
|
||||||
|
_setTheme(ev.data as string);
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (theme !== "default" && theme !== "sakura") {
|
if (theme !== "default" && theme !== "sakura") {
|
||||||
document.body.classList.remove("sakura-theme");
|
document.body.classList.remove("sakura-theme");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user