GarrettZhang
1/20/2018 - 7:11 AM

Web Notifications 桌面通知

// 桌面通知
function notify () {
  if (Notification && Notification.permission === 'granted') {
    let instance = new Notification(
        'title Notification', {
          body: 'notification HTML5 test',
          icon: 'logo.png'
        }
      )
  }
}
// 授权
function noticeInit () {
  if (Notification) {
    Notification.requestPermission(function (permission) {})
  }
}