Re: [w3ctag/design-reviews] Badging API (#387)

@alice Thanks for summarizing. That mostly accords with what we discussed in person. (_gazes wistfully out the window_ ... ahhh. Back in **the before times**. _sigh_)

It's a pretty nice insight I think: we previously discussed whether the two APIs should go on Navigator or Document, but I don't think anyone (before Alice) suggested that `setAppBadge` should go on Navigator, while `setClientBadge` should go on Document, to better convey the semantics that `setAppBadge` is setting something external to the document, while `setClientBadge` is specific to the current document. I like this and would be supportive of moving `setClientBadge` to Document, whilst keeping `setAppBadge` on Navigator. (Happily, this means we won't have to change Chrome's implementation which only has `setAppBadge`.)

> That being the case, I think the two APIs being so similar will create confusion - I'd be hard placed to remember which of `setAppBadge()` and `setClientBadge()` was going to do the thing I want.

Beyond putting them on different parent objects, I don't want to just make the two APIs different for the sake of being different. Even though they have different scope, lifetime and badge location, they both represent essentially the same data model and semantics for the badge:

- The data model (integer, flag or clear) is the same.
- The rules around displaying a badge (e.g., UA deciding whether to saturate the value) are the same.
- The semantics of how the API maps onto the model (e.g., calling `set()` sets it to the flag state whereas calling `set(0)` is equivalent to clearing) are the same.

I don't want to arbitrarily make the APIs different just so that users can better distinguish between the two.

But, I am supportive of moving `setClientBadge` and `clearClientBadge` to Document (or an object within).

Also @cmumford who is taking over ownership of the Badging API on the Chrome side.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/387#issuecomment-605785421

Received on Monday, 30 March 2020 05:10:03 UTC