关闭后,桌面上的推送通知会不断弹出

时间:2019-04-29 09:27:15

标签: node.js express socket.io

我正在使用Node,Express和Socket.io构建聊天应用程序

这是它的链接:https://shahchat.herokuapp.com/

这是示例测试工作

由于某种原因,试图关闭弹出窗口会一次又一次地重新加载它。

任何帮助或建议将不胜感激

JS代码

R.color.transparent = #00000000

套接字代码

function notifyMe(user, message) {
        // Let's check if the browser supports notifications
        if (!("Notification" in window)) {
          alert("This browser does not support desktop notification");
        }

        // Let's check if the user is okay to get some notification
        else if (Notification.permission === "granted") {
          // If it's okay let's create a notification
          var options = {
            title: user,
            body: message,
            dir: "ltr"
          };
          var notification = new Notification(user, options);
      }

1 个答案:

答案 0 :(得分:1)

您可以使用Chrome Notification,它同时适用于台式机端和移动端。