{}
usePermission
Reactive Permissions API. The Permissions API provides the tools to allow developers to implement a better user experience as far as permissions are concerned.
Usage
import { usePermission } from '@vueuse/core'
const microphoneAccess = usePermission('microphone')
Type Declarations
declare type DescriptorNamePolyfill = "clipboard-read" | "clipboard-write"
export declare type GeneralPermissionDescriptor =
| PermissionDescriptor
| DevicePermissionDescriptor
| MidiPermissionDescriptor
| PushPermissionDescriptor
| {
name: DescriptorNamePolyfill
}
export interface UsePermissionOptions<Controls extends boolean>
extends ConfigurableNavigator {
/**
* Expose more controls
*
* @default false
*/
controls?: Controls
}
export declare type UsePermissionReturn = Readonly<
Ref<PermissionState | undefined>
>
export interface UsePermissionReturnWithControls {
state: UsePermissionReturn
isSupported: boolean
query: () => Promise<PermissionStatus | undefined>
}
/**
* Reactive Permissions API.
*
* @see /usePermission
*/
export declare function usePermission(
permissionDesc:
| GeneralPermissionDescriptor
| GeneralPermissionDescriptor["name"],
options?: UsePermissionOptions<false>
): UsePermissionReturn
export declare function usePermission(
permissionDesc:
| GeneralPermissionDescriptor
| GeneralPermissionDescriptor["name"],
options: UsePermissionOptions<true>
): UsePermissionReturnWithControls
export {}