2.2.21 ⢠Published 9 months ago
svelte-mq-store v2.2.21
svelte-mq-store
š± Create any media-query store in Svelte
Demo
Installation
npm i svelte-mq-store
Usage
Use the listen
to subscribe to the contents of any media query.
<script>
import { listen } from 'svelte-mq-store'
const isDark = listen('(prefers-color-scheme: dark)')
</script>
{#if $isDark}
Device is dark mode
{:else}
Device is light mode
{/if}
Fallback in Server
Media queries are available only in the browser.
The fallback value used by the server during SSR can be specified as the second argument. (default is undefined).
import { listen } from 'svelte-mq-store'
const isDark = listen(
'(prefers-color-scheme: dark)',
false // fallback value
)
License
2.2.20
9 months ago
2.2.21
9 months ago
3.0.0-next.2
11 months ago
3.0.0-next.1
11 months ago
3.0.0-next.3
11 months ago
2.2.17
1 year ago
2.2.18
12 months ago
2.2.16
1 year ago
2.2.19
11 months ago
2.2.15
1 year ago
2.2.14
1 year ago
2.2.13
1 year ago
2.2.12
1 year ago
2.2.11
1 year ago
2.2.10
1 year ago
2.2.9
1 year ago
2.2.8
1 year ago
2.2.7
1 year ago
2.2.6
1 year ago
2.2.5
1 year ago
2.2.4
1 year ago
2.2.3
1 year ago
2.2.2
2 years ago
2.2.1
2 years ago
2.2.0
2 years ago
2.1.1
2 years ago
2.1.0
2 years ago
2.0.0
2 years ago
1.0.0
2 years ago
0.0.1
2 years ago