|
@@ -9,27 +9,16 @@ import NotificationWorker from 'worker-loader!./workers/notification.js'
|
|
|
|
|
|
if (typeof Worker === 'function') {
|
|
|
const notificationWorker = new NotificationWorker()
|
|
|
- console.log(notificationWorker)
|
|
|
+ notificationWorker.postMessage({
|
|
|
+ type: 'create',
|
|
|
+ title: '测试标题信息',
|
|
|
+ body: '您有新的代办事项'
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
-// (async function() {
|
|
|
-// if (Notification.requestPermission) {
|
|
|
-// const res = await Notification.requestPermission()
|
|
|
-// if (self.Notification.permission === 'granted') {
|
|
|
-// const n = new Notification('您有代办事项', {
|
|
|
-// body: '新的事项提醒',
|
|
|
-// data: {
|
|
|
-// url: '/setSilder/setSilder'
|
|
|
-// }
|
|
|
-// })
|
|
|
-// // console.log(n)
|
|
|
-// n.onclick = evt => {
|
|
|
-// n.close()
|
|
|
-// console.log(evt)
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// })();
|
|
|
+window.addEventListener('message', evt => {
|
|
|
+ console.log(evt)
|
|
|
+})
|
|
|
|
|
|
import * as constant from '@/constant'
|
|
|
|