Browse Source

增加系统通知fn

Caner 3 years ago
parent
commit
1ea60d2b16
1 changed files with 13 additions and 0 deletions
  1. 13 0
      main.js

+ 13 - 0
main.js

@@ -32,6 +32,19 @@ function screenShot () {
   })
   })
 }
 }
 
 
+// 消息通知
+function notifiction (title, options) {
+	const WebNotification =  window.Notification || window.mozNotification || window.webkitNotification
+    const isTrue = WebNotification.requestPermission(result => {
+      return (result === 'granted') // granted(允许) || denied(拒绝)
+    })
+    const noti =  new WebNotification(title, options)
+    noti.onclick=()=>{
+      console.log('关闭')
+    }
+}
+
+
 // 创建loading 窗口
 // 创建loading 窗口
 const showLoading = () => {
 const showLoading = () => {
   loadingWin = new BrowserWindow({
   loadingWin = new BrowserWindow({