useSupported ​
SSR compatibility isSupported
Usage ​
ts
import { useSupported } from '@vueuse/core'
const isSupported = useSupported(() => navigator && 'getBattery' in navigator)
if (isSupported.value) {
// do something
navigator.getBattery
}
Type Declarations ​
typescript
export declare function useSupported(
callback: () => unknown,
): ComputedRef<boolean>
Source ​
Contributors ​
Anthony Fu
Anthony Fu
Fernando Fernández
Jelf
Changelog ​
v12.0.0-beta.1
on 11/21/2024v10.0.0-beta.2
on 3/28/2023