-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attach to navigator instead? #14
Comments
Seems fine; I'm concerned about polluting the |
nah, just |
Fixie typos 🤪 |
Oh so you're just proposing for the Badge class to live in Navigator? |
yeah, sorry for not being clear. |
Hmm, I don't see the advantage of using navigator if you're just going to use a sub-object anyway... |
Yeah, it's somewhat cargo-cultish... navigator.geolocation and so on... I don't have a strong opinion. |
I'd use setBadge and clearBadge btw. I don't see the need for a tearoff object. |
FWIW the I like it because it avoids the need for a non-constructible class like |
Maybe we can get away with just |
See #19; TLDR of my argument there is that I don't recommend overloading, and think separate functions would be much better. |
Just to confirm, the consensus here is on |
Seems like it. Closing. |
Reopening this, as it came up in the TAG review. In w3ctag/design-reviews#387 (comment) @alice points out that having the badge on navigator makes it more obvious that the badge is for all instances of a site (while If we do decide to go this route, I'm partial to the |
I don't quite get the reasoning why Badge (aka window.Badge) feels different from navigator.Badge (aka window.navigator.Badge) in this regard. |
It could just be that using static methods on global objects feels a bit weird. There very few interfaces that provide static methods... while the |
I think the discoverability would actually be harmed, as you'd have to first know it exists on navigator. Although I'm not sure how much that should guide API design. You're right that this should be a namespace (like Math, Reflect, console, CSS, etc.) rather than an interface with only static methods. See https://w3ctag.github.io/design-principles/#constructors and particularly https://w3ctag.github.io/design-principles/#example-09c8f087. |
I'd like to better understand the answer to this related question from our review first:
|
Somewhat related #12 and #5 ... the distinction is not something we've managed to nail down. Like, we broadly understand what it means to "install" a web app and isolate it from the browser... but then we have things like browser tabs/single-page web apps, that could also make use of this API: imagine two instances of gmail running for two different accounts, each using this API in pinned browser tabs. So I honestly don't know if we will be able to answer that particular question for a while. |
A per app badge is displayed in an operating system specific location (e.g. the dock, the start menu, the home screen, the taskbar). There can only be one of these badges for an "app". What can be badged is constrained by the operating system. A per instance badge is tied to a specific instance of a site (and so would be displayed in an instance specific location, such as the tab or window favicon). There can be as many different badges as there are instances (tabs or windows) of a site. What can be badged is constrained by the user agent. As @marcoscaceres says, we're still grappling with this. |
For an installed app, is it possible to have more than one instance of it running? For gmail (or slack), this is a situation I have quite often... different slack workspaces in different tabs, each with their own favicon/title status, similarly with different gmail accounts (or even the same one), similarly with calendar, etc. |
For slack in particular, I believe that each workspace would have its own app (slack uses Gmail is more interesting, assuming you can swap accounts inside the PWA (say, having your work and personal accounts open in separate windows). There is only one place to display an application badge (the dock icon, taskbar icon or homescreen icon, depending on the OS), so the separate accounts would have to share the badge, perhaps displaying the sum of unread emails over all accounts. An alternative solution would be to create separate PWAs for each account (in Gmail, this could be done by setting the scope to I feel like this is a good argument for keeping |
@annevk suggested it might be good to just attach this as an attribute on
navigator
. I think that makes sense to align with other APIs (and given that one can't constructnew Badge()
etc).The text was updated successfully, but these errors were encountered: