forked from MicrosoftEdge/MSEdgeExplainers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split Widget Events (MicrosoftEdge#613)
* Split Widget Events When we were testing Widgets, we found an issue when opening a PWA using https://developer.mozilla.org/en-US/docs/Web/API/Clients/openWindow API from the service worker is not possible from the `widgetclick` handler. This is because `client.openWindow` API works only with some event handlers (notificationclick, paymentrequest and backgroundfetchclick). We can add the support of adding the window interaction in `widgetclick` event but this API (openWindow) is gated for only user interaction events and `widgetclick` event can occur even without user interacting with the widgets (like `widgetresume` event on scrolling the widgets dashboard). The proposed solution will be dividing the event in to two types of events. 1. “widgtinstall”, “widgetuninstall” and “widgetresume”: Handle widget lifecycle events self.addEventListener(“widget”, (event) => { if (event.action === “widget-install”) handleInstall() }); 2. “widgetclick” Event: Scoped only for user interaction with widgets (Action.Execute) self.addEventListener(“widget”, (event) => { if (event.action === “verb”) getClient().openWindow() });
- Loading branch information
1 parent
25d5577
commit 66e392e
Showing
1 changed file
with
138 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters