Re: [push-api] Rename hasPermission (#136)

API design decisions made in the Java libraries seem entirely orthogonal to me? While WebIDL does allow for implementations in other languages, the foremost candidate will be JavaScript.

> You don't think that getPermission() is awfully similar to requestPermission()?

Reading the method name, one would "get permission" from the "push manager". I agree that this is confusing - linguistically the act of getting permission is ambiguous, and does not clarify whether it will just return the current status or actually request permission from the user.

> Naming it permission() would be fine with me (so similar, but a method).

That might cause confusion with `Notification.permission`, which is what some early adopters of the Push API in Chrome (unfortunately) are using to check the permission status, as it returns a boolean. We won't be able to change that to return a Promise due to maintaining backwards compatibility.

> Others from Google suggested getPermissionState() over in the BackgroundSync repo

getPermissionState() is clear on both counts, but also very verbose. A typical use of the API could end up looking as follows:

`serviceWorkerRegistration.pushManager.getPermissionState().then(...)`

(Making me remember the days where pushManager was called pushRegistrationManager.)

I don't have a strong preference for either of these method names. To throw in another alternative that could be considered: `checkPermission`.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/push-api/issues/136#issuecomment-94490079

Received on Monday, 20 April 2015 15:49:59 UTC