Skip to content

Commit

Permalink
fix: comment test notification
Browse files Browse the repository at this point in the history
  • Loading branch information
oeyoews committed Oct 19, 2024
1 parent 35939b1 commit d9d8e54
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions plugins/oeyoews/notify/tiddlers/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,40 @@ exports.platforms = ['browser'];
exports.after = ['startup'];
exports.synchronous = true;
exports.startup = () => {
debugger;
if (!('Notification' in window)) {
alert('This browser does not support desktop notification');
}
if (Notification.permission !== 'denied') {
//判断是否授权,没授权先授权在通知
Notification.requestPermission(function (permission) {
// 如果用户同意,就可以向他们发送通知
if (permission === 'granted') {
var notice_ = new Notification('通知', {
body: '你有一条信息',
});
notice_.onclick = function () {
//单击消息提示框,进入浏览器页面
window.focus();
};
}
});
}
if (Notification.permission === 'denied') {
//已授权直接通知
Notification.requestPermission(function (permission) {
// 如果用户同意,就可以向他们发送通知
if (permission === 'granted') {
var notice_ = new Notification('通知', {
body: '你手动了一条新的一条信息for tiddlywiki',
});
notice_.onclick = function () {
//单击消息提示框,进入浏览器页面
window.focus();
};
}
});
}
// debugger;
// if (!('Notification' in window)) {
// alert('This browser does not support desktop notification');
// }
// if (Notification.permission !== 'denied') {
// //判断是否授权,没授权先授权在通知
// Notification.requestPermission(function (permission) {
// // 如果用户同意,就可以向他们发送通知
// if (permission === 'granted') {
// var notice_ = new Notification('通知', {
// body: '你有一条信息',
// });
// notice_.onclick = function () {
// //单击消息提示框,进入浏览器页面
// window.focus();
// };
// }
// });
// }
// if (Notification.permission === 'denied') {
// //已授权直接通知
// Notification.requestPermission(function (permission) {
// // 如果用户同意,就可以向他们发送通知
// if (permission === 'granted') {
// var notice_ = new Notification('通知', {
// body: '你手动了一条新的一条信息for tiddlywiki',
// });
// notice_.onclick = function () {
// //单击消息提示框,进入浏览器页面
// window.focus();
// };
// }
// });
// }
$tw.rootWidget.addEventListener('om-notify', (event) => {
const { paramObject = {} } = event;
new $tw.Notify().display(paramObject);
Expand Down

0 comments on commit d9d8e54

Please sign in to comment.