Angle: 0
Type: landscape-primary
Manage and respond to changes in device orientation with useOrientation.
Angle: 0
Type: landscape-primary
import type { Writable } from "svelte/store";
import { writable } from "svelte/store";
import { useIntervalFn } from "@/hooks/useIntervalFn";
export function useNow(): Writable<Date> {
const now = writable(new Date());
const update = () => { now.set(new Date()) }
useIntervalFn(update, 1000, { immediate: true });
return now;
} <!-- javascript -->
<script lang="ts">
import { useOrientation } from "@dimaslz/svelteuse";
const orientation = useOrientation();
</script>
<!-- html -->
<div>
<p>Angle: {$orientation.angle}</p>
<p>Type: {$orientation.type}</p>
</div>