Class Permissions
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The Permissions interface of the Permissions API provides the core Permission API functionality, such as methods for querying and revoking permissions
[Value("Permissions")]
public class Permissions
- Inheritance
-
Permissions
- Inherited Members
Remarks
Constructors
Permissions()
public Permissions()
Methods
Query(Object)
The query() method of the Permissions interface returns the state of a user permission on the global scope.
[Value("query")]
public Task<PermissionStatus> Query(Object permissionDesc)
Parameters
permissionDescObject
Returns
- Task<PermissionStatus>
A {{jsxref("Promise")}} that resolves to a PermissionStatus object.
Remarks
The user permission names are defined in the respective specifications for each feature.
The permissions supported by different browser versions are listed in the compatibility data of the Permissions interface (see also the relevant source code for Firefox values, Chromium values, and WebKit values).
The APIs that are gated by each permission are listed in Permission-aware APIs in the Permissions API overview topic.
Request(Object)
[Value("request")]
public Task<PermissionStatus> Request(Object permissionDesc)
Parameters
permissionDescObject
Returns
Revoke(Object)
IMPORTANT
Deprecatedrevoke() method of the Permissions interface reverts a currently set permission back to its default state, which is usually prompt.This method is called on the global Permissions object Permissions.
[Value("revoke")]
public Task<PermissionStatus> Revoke(Object permissionDesc)
Parameters
permissionDescObject
Returns
- Task<PermissionStatus>
A {{jsxref("Promise")}} that calls its fulfillment handler with a PermissionStatus object indicating the result of the request.
Remarks
This method is removed from the main permissions API specification because its use case is unclear.
Permissions are managed by the browser and the current permission model does not involve the site developer being able to imperatively request or revoke permissions. Browsers have shipped this API behind preferences but it's unlikely to reach the standards track.
For more context, see the original discussion to remove permissions.revoke().