Skip to content

Commit

Permalink
feat(app): device width store
Browse files Browse the repository at this point in the history
  • Loading branch information
Swepool committed Jul 3, 2024
1 parent 7610e77 commit a2e1ebb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/src/lib/utilities/device.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { writable } from "svelte/store";

export const deviceWidth = writable<number>()
2 changes: 2 additions & 0 deletions app/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import LoadingBar from "$lib/components/loading-bar.svelte"
import { SvelteQueryDevtools } from "@tanstack/svelte-query-devtools"
import { PersistQueryClientProvider } from "@tanstack/svelte-query-persist-client"
import { disablePinchToZoom } from "$lib/utilities/disable-pinch-to-zoom.ts"
import { deviceWidth } from "$lib/utilities/device.ts";
const { queryClient, localStoragePersister } = createQueryClient()
if (browser) notifyManager.setScheduler(window.requestAnimationFrame)
Expand All @@ -40,6 +41,7 @@ if (browser) notifyManager.setScheduler(window.requestAnimationFrame)
</svelte:head>

<svelte:window
bind:innerWidth={$deviceWidth}
use:shortcut={{
trigger: [
// easily hide tanstack devtools with ctrl + h
Expand Down

0 comments on commit a2e1ebb

Please sign in to comment.