mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
* chore(deps-dev): upgrade svelte to v0.8.1 * chore: regenerate types to correctly type function declarations * test: fix svelte-check warnings
22 lines
477 B
Svelte
22 lines
477 B
Svelte
<script lang="ts">
|
|
import { LocalStorage } from "../types";
|
|
|
|
let storage: LocalStorage;
|
|
let toggled = false;
|
|
let events = [];
|
|
|
|
$: if (storage) storage.clearItem();
|
|
$: if (storage) storage.clearAll();
|
|
</script>
|
|
|
|
<LocalStorage
|
|
bind:this="{storage}"
|
|
key="dark-mode"
|
|
bind:value="{toggled}"
|
|
on:save="{() => {
|
|
events = [...events, { event: 'on:save' }];
|
|
}}"
|
|
on:update="{({ detail }) => {
|
|
events = [...events, { event: 'on:update', detail }];
|
|
}}"
|
|
/>
|