diff --git a/apps/svelte-example/src/App.svelte b/apps/svelte-example/src/App.svelte index 5e48f8a..c5ebd5a 100644 --- a/apps/svelte-example/src/App.svelte +++ b/apps/svelte-example/src/App.svelte @@ -1,9 +1,7 @@
diff --git a/packages/web-haptics/src/svelte/createWebHaptics.ts b/packages/web-haptics/src/svelte/createWebHaptics.ts index db51ac9..3fb04fe 100644 --- a/packages/web-haptics/src/svelte/createWebHaptics.ts +++ b/packages/web-haptics/src/svelte/createWebHaptics.ts @@ -1,3 +1,4 @@ +import { onDestroy } from "svelte"; import { WebHaptics } from "../lib/web-haptics"; import type { HapticInput, @@ -15,5 +16,7 @@ export function createWebHaptics(options?: WebHapticsOptions) { const setDebug = (debug: boolean) => instance.setDebug(debug); const isSupported = WebHaptics.isSupported; + onDestroy(destroy); + return { trigger, cancel, destroy, setDebug, isSupported }; } diff --git a/site/src/surfaces/usage/index.tsx b/site/src/surfaces/usage/index.tsx index bc40168..d3b33da 100644 --- a/site/src/surfaces/usage/index.tsx +++ b/site/src/surfaces/usage/index.tsx @@ -29,9 +29,7 @@ const { trigger } = useWebHaptics(); `, svelte: ` `,