permissions allows you to observe the state of a given browser permission.
For example, you may wish to observe the state of the geolocation permission
and know when it becomes granted.
class MyElement extends LitElement {
constructor() {
super();
this._permissionsCtrl = new PermissionsController(this, 'geolocation');
}
render() {
return html`
Geolocation permission is ${this._permissionsCtrl.state}
`;
}
}The required argument is a permission name which varies across browsers in some cases.
The controller will expose a state property which is either a valid
PermissionState
or the string pending.
Initially, while querying the browser for a state, the state will be set to
pending.
N/A