Skip to content

useSupported

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

SSR 兼容性检测 isSupported

用法

ts
import { 
useSupported
} from '@vueuse/core'
const
isSupported
=
useSupported
(() =>
navigator
&& 'getBattery' in
navigator
)
if (
isSupported
.
value
) {
// 执行一些操作
navigator
.getBattery
}

类型声明

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

源码

源码文档

贡献者

一纸忘忧
Vida Xie
SerKo
Robin
Anthony Fu
Anthony Fu
Fernando Fernández
Jelf

更新日志

d32f8 - refactor: add @__NO_SIDE_EFFECTS__ annotations to all pure functions (#4907)
9afee - feat(useCached): add options.deepRefs (#4591)
0a9ed - feat!: drop Vue 2 support, optimize bundles and clean up (#4349)