Re: [w3c/permissions] Add name attribute to PermissionStatus (#248)

It looks like the aim could be to future-proof the API for the case where one day `query()` could allow for multiple permissions to be queried. Right now, the recommendation is to [use `Promise.all()`](https://w3c.github.io/permissions/#:~:text=using-,promise.all,-Promise) for this, which seems like a not too far off idea. 

```js
// Now
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);
});
```

```js
// Potential future
const states = await navigator.permissions.query({
  name: "geolocation",
  name: "notifications",
});
```

-- 
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/pull/248#issuecomment-867396816

Received on Thursday, 24 June 2021 07:10:24 UTC