WICG / web-app-launch

Web App Launch Handler
Other
74 stars 31 forks source link

Reconsider the naming of route_to and its enum values #59

Closed alancutter closed 1 year ago

alancutter commented 2 years ago

Previously route_to had the values auto, new-client, existing-client and in the future service-worker. These were all clearly destinations. Now that navigate_existing_client has been folded into route_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 name route_to. The term "mode" is more general and can cover both aspects.

Alternatives:

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.

tomayac commented 2 years ago

Throwing one more proposal in the ring:

mgiuca commented 2 years ago

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.

tomayac commented 2 years ago

Or go the CSS way which allows grey and gray.

alancutter commented 2 years ago

Let's do that when CSS supports colour and color. :P

alancutter commented 2 years ago

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.

kenchris commented 2 years ago

the new one is also being navigates, so shouldn't it be navigate-new?

alancutter commented 2 years ago

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.

alancutter commented 1 year ago

Updated spec to: client_mode: auto | navigate-new | navigate-existing | focus-existing