We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<DarkMode on:change={(e) => { console.log(e.detail); // "dark" | "light" }} />
The event is not dispatched only after a full browser reloads then I see the console log. Using this repo with the latest SvelteKit
The text was updated successfully, but these errors were encountered:
When I use this component with SvelteKit, I see the change event being dispatched when the page mounts, and also whenever I update the theme.
change
Is this what you would expect? To help further, it would be useful if you could provide a minimal repro.
<script> import DarkMode from "svelte-dark-mode"; let theme; $: switchTheme = theme === "dark" ? "light" : "dark"; $: if (typeof document !== "undefined") { document.body.className = theme; } </script> <DarkMode bind:theme on:change={(e) => { console.log(e.detail); // "dark" | "light" }} /> <h1>This is {theme} mode.</h1> <p>Change the theme and reload the page.</p> <button on:click={() => (theme = switchTheme)}> Switch to {switchTheme} mode </button> <style> :global(.dark) { background: #032f62; color: #f1f8ff; } </style>
Sorry, something went wrong.
No branches or pull requests
<DarkMode on:change={(e) => { console.log(e.detail); // "dark" | "light" }} />
The event is not dispatched only after a full browser reloads then I see the console log.
Using this repo with the latest SvelteKit
The text was updated successfully, but these errors were encountered: