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 ​
Fernando Fernández
Jelf
Changelog ​
v10.0.0-beta.2
on 3/28/2023