📜  js 桌面通知 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:12.583000             🧑  作者: Mango

代码示例1
notify(message = '', title = '', logoUrl, redirectUrl) {
    Notification.requestPermission().then((result) => {
      console.log(result);
      const notification = new Notification(title, {
        icon: logoUrl,
        body: message,
      });
      notification.onclick = () => {
        window.open(redirectUrl);
      };
    });
  }