Skip to content
On this page

useSupported

Category
Export Size
823 B
Last Changed
5 months ago

SSR compatibility isSupported

Usage

ts
import { useSupported } from '@vueuse/core'

const isSupported = useSupported(() => navigator && 'getBattery' in navigator)

if (isSupported.value) {
  // do something
  navigator.getBattery
}
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,
  sync?: boolean
): Ref<boolean>
export declare function useSupported(
  callback: () => unknown,
  sync?: boolean
): Ref<boolean>

Source

SourceDocs

Contributors

Jelf

Changelog

v8.9.2 on 7/12/2022
81d92 - fix(all)!: isSupported becomes Ref instead of boolean for SSR compatibility (#1800)

Released under the MIT License.