- From: Thomas Steiner <notifications@github.com>
- Date: Thu, 24 Jun 2021 00:09:56 -0700
- To: w3c/permissions <permissions@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 24 June 2021 07:10:24 UTC
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