Re: [w3c/manifest] Add a manifest option for the declaration of the web application running pattern (Issue #1019)

@alancutter Sorry for the late reply.

Because I have re-reviewed the original intention of this proposal in this few days, and checked the relevant materials and examples of launch_handler carefully:

- [Web App Launch Handling](https://github.com/WICG/sw-launch/blob/main/launch_handler.md)
- [Control how your app is launched](https://web.dev/launch-handler/)

It's nice that we're trying to solve a similar problem, just with a different solution and different final result.

The `launch_handler` has been updated by several versions. Currently, the `route_to` attribute has four values: `auto`, `new-client`, `existing-client-navigate`, `existing-client-retain`. The difference between `existing-client-navigate` and `existing-client-retain` is navigating the existing web app instance to a new URL or not. And it needs some interfaces to developers, such as `LaunchQueue`, `LaunchParams`, `LaunchConsumer`.

I have tried to think how to implement similar application scenarios only with the existing Web specification that have been defined by W3C. Most application features can be done through the combination of Service Worker and LocalStorage. Except when new navigation try to focus a existing instance that has not been defined and the user agent has not been provided the capability.

We implemented the features in based on Chromium project last year and made an example, you can watch the demo video: [Singleton Pattern PWA Demo](https://www.bilibili.com/video/BV12R4y1s7E2/) (p.s, the video language is Chinese). We made some conclusions with the implementation:
1. The control logic of "single instance/reuse of existing instance" can be easily realized, whether the PWA is in standalone or browser display mode;
2. If there is no additional control, the user can break this feature by manually entering the URL in a new tab, but it is also could be limit;
3. Additional "strict-mode" configuration can be give developers as a choice.
Inspired from launch_handler, the value of pattern should update from `non-singleton(default), singleton` to `default, non-singleton, singleton, singleton-strict`.

The least important thing is naming the manifest member as `pattern`/`launch_handler` or the words used to represent the attribute value. At this moment, it is not our priority.

BTW: The Sudoku Game I used as an example wasn't good earlier, but your Music Player example to description the scene is great.

I am very happy to have exchanges thoughts on this proposal continuously, and promote this to the W3C specification and the user agent implementation together.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/issues/1019#issuecomment-1119392185
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/manifest/issues/1019/1119392185@github.com>

Received on Friday, 6 May 2022 08:45:33 UTC