963 markdown files reformatted with the repository's pinned prettier so pnpm format:check covers the folded tree like every other repo file. The formatter's embedded-language pass also normalized code fences (TS semicolons, closed HTML tags in examples, lowercased CSS hex colors, one renumbered list that skipped an index). Alphanumeric token deltas vs the fold commit were audited file-by-file; all are formatter-equivalent markup normalizations plus the four sanitized skills.
1.8 KiB
1.8 KiB
category
| category |
|---|
| Browser |
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
type DescriptorNamePolyfill =
| 'accelerometer'
| 'accessibility-events'
| 'ambient-light-sensor'
| 'background-sync'
| 'camera'
| 'clipboard-read'
| 'clipboard-write'
| 'gyroscope'
| 'magnetometer'
| 'microphone'
| 'notifications'
| 'payment-handler'
| 'persistent-storage'
| 'push'
| 'speaker'
| 'local-fonts';
export type GeneralPermissionDescriptor =
| PermissionDescriptor
| {
name: DescriptorNamePolyfill;
};
export interface UsePermissionOptions<Controls extends boolean> extends ConfigurableNavigator {
/**
* Expose more controls
*
* @default false
*/
controls?: Controls;
}
export type UsePermissionReturn = Readonly<ShallowRef<PermissionState | undefined>>;
export interface UsePermissionReturnWithControls {
state: UsePermissionReturn;
isSupported: ComputedRef<boolean>;
query: () => Promise<PermissionStatus | undefined>;
}
/**
* Reactive Permissions API.
*
* @see https://vueuse.org/usePermission
*
* @__NO_SIDE_EFFECTS__
*/
export declare function usePermission(
permissionDesc: GeneralPermissionDescriptor | GeneralPermissionDescriptor['name'],
options?: UsePermissionOptions<false>,
): UsePermissionReturn;
export declare function usePermission(
permissionDesc: GeneralPermissionDescriptor | GeneralPermissionDescriptor['name'],
options: UsePermissionOptions<true>,
): UsePermissionReturnWithControls;