Namespace: SpawnDev.SpawnJS.JSObjects
Inherits: SpawnJSObject
Source: JSObjects/Permissions.cs
MDN Reference: Permissions on MDN
The Permissions interface of the Permissions API provides the core Permission API functionality, such as methods for querying and revoking permissions https://developer.mozilla.org/en-US/docs/Web/API/Permissions
| Signature | Description |
|---|---|
Permissions(SpawnJSObjectReference _ref) |
Deserialization constructor |
| Method | Return Type | Description |
|---|---|---|
Query(PermissionDescriptor permissionDescriptor) |
Task<PermissionStatus> |
Returns the user permission status for a given API. |
SpawnDev.SpawnJS Mapping Note: The JavaScript examples below show the standard Web API usage. In SpawnDev.SpawnJS, the same API is available with C# conventions:
- Properties and methods use PascalCase (e.g.,
readyStatebecomesReadyState)- Events use ActionEvent with
+=/-=(e.g.,addEventListener("click", fn)becomesOnClick += handler)- Async methods return
Task<T>instead ofPromise<T>- Objects should be disposed with
usingstatements- Access via
JS.Get<Permissions>(...)or constructornew Permissions(...)
navigator.permissions.query({ name: "geolocation" }).then((result) => {
if (result.state === "granted") {
showLocalNewsWithGeolocation();
} else if (result.state === "prompt") {
showButtonToEnableLocalNews();
}
// Don't do anything if the permission was denied.
});