- From: Marcos Cáceres <notifications@github.com>
- Date: Tue, 20 Apr 2021 23:03:39 -0700
- To: w3c/permissions <permissions@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 21 April 2021 06:04:06 UTC
`PermissionStatus` should expose the `.name` of the status it's holding the permission for. Otherwise, the developer is forced to independently track then name of a permission using, for example, array order (🤢)... this issue shown in the examples, where array order is used to get the name (`geoState`, and `notifState`): ```JS Promise.all([ navigator.permissions.query({ name: "geolocation" }), navigator.permissions.query({ name: "notifications" }) ]) .then(([{ state: geoState }, { state: notifState }]) => { console.log("Geolocation permission state is:", geoState); console.log("Notifications permission state is:", notifState); }); ``` The ideal design would be: ```JS const promises = ["geolocation", "notifications"].map( name => navigator.permissions.query( { name } ) ) const results = await Promise.all(promises); for (const { name, state } of results) { console.log("Permission ${name} state is ${state}"); } ``` -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/permissions/issues/237
Received on Wednesday, 21 April 2021 06:04:06 UTC