A delegate which checks and requests a single permission on behalf of the SDK, replacing the SDK's default handling for that permission or supporting one the SDK does not have a default for.
Either method may resolve the browser's PermissionState as-is (e.g. the
state from navigator.permissions.query()), and prompt is reported as
not_determined.
Methods
checkPermissionStatus() → {Promise.<(UaPermissionState|PermissionState)>|Promise.<(UaPermissionState|PermissionState)>}
Called when the permission status needs to be checked. This must not prompt the user.
Returns:
-
- Type:
-
Promise.<(UaPermissionState|PermissionState)>
the current permission status
-
- Type:
-
Promise.<(UaPermissionState|PermissionState)>
requestPermission(isUserInteraction) → {Promise.<(UaPermissionState|PermissionState)>|Promise.<(UaPermissionState|PermissionState)>}
Called when the permission should be requested. The permission may already be granted when this is called.
Parameters:
| Name | Type | Description |
|---|---|---|
isUserInteraction |
boolean
|
whether the request originates from a user gesture; most browsers ignore or reject permission prompts without one |
Returns:
-
- Type:
-
Promise.<(UaPermissionState|PermissionState)>
the permission status after the request
-
- Type:
-
Promise.<(UaPermissionState|PermissionState)>