requestPermission
Functional API
requestPermissionYou can use the same function with this as well.
Feature description
Requests permission. For permissions that haven't been decided yet (notDetermined) if it is a permission, it shows a permission request to the user, and if the permission has already been decided, it returns the decided state as-is. The result is always allowed or denied.
Type
requestPermission(permission: { name: PermissionName; access: PermissionAccess }): Promise<Exclude<PermissionStatus, "notDetermined">>;Params
type PermissionName =
"clipboard" | "contacts" | "photos" | "geolocation" | "camera" | "microphone";
type PermissionAccess = "read" | "write" | "access";Response
type PermissionStatus = "notDetermined" | "denied" | "allowed";
// The request result is one of "allowed" | "denied", excluding notDetermined.Example code
import { Permissions } from "@apps-in-toss/web-framework";
const status = await requestPermission({ name: "camera", access: "access" });
if (status === "allowed") {
console.log("Camera permission was granted.");
}Was this helpful?