Introduce vibrateIfPossible into the utils package. This will check if the browser

has support for vibrating. This fixes a number of bugs for iOS safari & friends.
This commit is contained in:
Haze Booth
2023-08-24 12:02:22 -04:00
parent 6f02912d2e
commit 63d51e9119
12 changed files with 34 additions and 24 deletions

View File

@@ -3,7 +3,7 @@
import { type WidgetLayout } from "$lib/stores/layoutStates";
import { Range } from "$lib/components/gradio/form";
import { get, type Writable } from "svelte/store";
import { debounce } from "$lib/utils";
import { debounce, vibrateIfPossible } from "$lib/utils";
import interfaceState from "$lib/stores/interfaceState";
import { isDisabled } from "./utils"
export let widget: WidgetLayout | null = null;
@@ -96,7 +96,7 @@
lastDisplayValue = option;
canVibrate = false;
setTimeout(() => { canVibrate = true }, 30)
navigator.vibrate(10)
vibrateIfPossible(10)
}
}
</script>