mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-05 13:39:40 +08:00
14 lines
332 B
TypeScript
14 lines
332 B
TypeScript
import { tryOnMounted } from './tryOnMounted';
|
|
import { shallowRef } from 'vue';
|
|
|
|
export function useSupported(callback: () => unknown, sync = false) {
|
|
const isSupported = shallowRef<boolean>();
|
|
|
|
const update = () => (isSupported.value = Boolean(callback()));
|
|
|
|
update();
|
|
|
|
tryOnMounted(update, sync);
|
|
return isSupported;
|
|
}
|