Closed alancutter closed 1 year ago
Throwing one more proposal in the ring:
client_behavior: auto | new | navigate-existing | focus-existing | service-worker
client_behavior
As a British speller, I vote that we avoid a name that can be spelled with or without a 'u' depending on where you're from.
Let's do that when CSS supports colour
and color
. :P
Enumerating a bunch of options:
1. route_to: auto | new-client | existing-client-navigate | existing-client-retain | service-worker
2. route_to_client: auto | new | navigate-existing | focus-existing | via-service-worker
3. target_client: auto | new | navigate-existing | focus-existing | via-service-worker
4. target_client_mode: auto | new | navigate-existing | focus-existing | via-service-worker
5. client_mode: auto | new | navigate-existing | focus-existing | via-service-worker
6. client_behavior: auto | new | navigate-existing | focus-existing | via-service-worker
Thoughts on each:
1. route_to: auto | new-client | existing-client-navigate | existing-client-retain | service-worker
+Reads okay as a sentence.
-Is routing to more than just a target client but also saying what happens to it in the existing-client case.
2. route_to_client: auto | new | navigate-existing | focus-existing | via-service-worker
+Uses the word "client" meaning it doesn't need to appear in the values.
-Is routing to more than just a target client but also saying what happens to it in the existing-client case.
-Almost reads like a sentence but doesn't and is actually quite awkward for it.
3. target_client: auto | new | navigate-existing | focus-existing | via-service-worker
+Uses the word "client" meaning it doesn't need to appear in the values.
-Doesn't work well as a sentence, devs would need to look up the meaning.
4. target_client_mode: auto | new | navigate-existing | focus-existing | via-service-worker
-Too long and complicated.
5. client_mode: auto | new | navigate-existing | focus-existing | via-service-worker
+Uses the word "client" meaning it doesn't need to appear in the values.
-Maybe ambiguous about which client is being referred to; the web app client or the browser client that triggered the launch.
6. client_behavior: auto | new | navigate-existing | focus-existing | via-service-worker
-Doesn't capture the "route launch to a target client" part of what's going on which is probably the more important part.
I'm split between the field name having the right "scope" (as in defining a target location and optional follow up behaviours), using the word "client" to reduce the enum value names and reading nicely as a sentence. route_to
reads the best of them all and client_mode
ticks the other two boxes.
the new one is also being navigates, so shouldn't it be navigate-new
?
Good point.
route_to: auto | new-client-navigate | existing-client-navigate | existing-client-retain/focus | service-worker
client_mode: auto | navigate-new | navigate-existing | focus-existing | via-service-worker
I think client_mode
is the winner for me now.
Updated spec to: client_mode: auto | navigate-new | navigate-existing | focus-existing
Previously
route_to
had the valuesauto
,new-client
,existing-client
and in the futureservice-worker
. These were all clearly destinations. Now thatnavigate_existing_client
has been folded intoroute_to
it contains behaviour information as well:existing-client-navigate
,existing-client-retain
. Given the change in semantics from a destination to destination + behaviour we should reconsider the nameroute_to
. The term "mode" is more general and can cover both aspects.Alternatives:
route_mode: auto | new-client | existing-client-navigate | existing-client-retain | service-worker
client_mode: auto | new | navigate-existing | focus-existing | service-worker
I'm inclined to go with
client_mode
since a window client is always involved in the launch.cc: @mgiuca for raising the issue in https://github.com/WICG/sw-launch/issues/56. cc: @kenchris who had opinions about existing-client-navigate/retain during TAG review.