Try focus first, then postMessage

This commit is contained in:
Lim Chee Aun 2023-10-19 17:45:27 +08:00
parent e9075906f8
commit c9545cdc34

View file

@ -179,12 +179,12 @@ self.addEventListener('notificationclick', (event) => {
console.log('NOTIFICATION CLICK navigate', url);
if (bestClient) {
console.log('NOTIFICATION CLICK postMessage', bestClient);
bestClient.focus();
bestClient.postMessage?.({
type: 'notification',
id: tag,
accessToken: access_token,
});
bestClient.focus();
} else {
console.log('NOTIFICATION CLICK openWindow', url);
await self.clients.openWindow(url);