Skip to content

useSupported

Category
Export Size
176 B
Last Changed
2 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
}

Type Declarations

typescript
export declare function useSupported(
  callback: () => unknown,
): ComputedRef<boolean>
export type UseSupportedReturn = ReturnType<typeof useSupported>

Source

SourceDocs

Contributors

Robin
Anthony Fu
Anthony Fu
Fernando Fernández
Jelf

Changelog

v12.8.0 on
9afee - feat(useCached): add options.deepRefs (#4591)
v12.0.0-beta.1 on
0a9ed - feat!: drop Vue 2 support, optimize bundles and clean up (#4349)
v10.0.0-beta.2 on
55a32 - feat: support tracking reactivity for the callback function (#2904)

Released under the MIT License.

Save 37% on one year of learning Vue, Includes the Vue.js Master Class.
Get Offer