我正在为我的网站启用 Web 通知,并将下面的事件侦听器添加到 service worker .js 文件中,这在边缘运行良好,单击事件被触发并打开一个新窗口,但是 chrome 没有任何反应并且事件本身不会触发 -
self.addEventListener('notificationclick', function (event) {
event.notification.close();
console.log('Notification notificationclick triggered');
event.waitUntil(
clients.openWindow(event.notification.data)
);
})
Run Code Online (Sandbox Code Playgroud)