Skip to content

useSupported

类别
导出体积
176 B
上次更改
2 months ago

SSR 兼容性检测 isSupported

用法

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

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

if (isSupported.value) {
  // 执行一些操作
  navigator.getBattery
}

类型声明

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

源码

源码文档

贡献者

一纸忘忧
Anthony Fu
Anthony Fu
Fernando Fernández
Jelf

更新日志

v12.0.0-beta.1 on 11/21/2024
0a9ed - feat!: drop Vue 2 support, optimize bundles and clean up (#4349)
v10.0.0-beta.2 on 3/28/2023
55a32 - feat: support tracking reactivity for the callback function (#2904)