优先级 < 0 的 Chrome 扩展通知 (chrome.notifications) 的行为是什么?
What is the behavior of a Chrome extension notification (chrome.notifications) shown with priority < 0?
在我看来是这样的:
var message = 'Hello world!';
var title = 'Hello world!';
var notificationOptions = {
type: 'basic',
title: title,
message: message,
iconUrl: chrome.extension.getURL('assets/images/icon-32.png'),
priority: -1
};
chrome.notifications.create(
'my_notification',
'my_notification_id',
notificationOptions,
function() {}
);
永远不会显示。原因是优先级:-1。那么负面优先级的真正含义是什么以及它们如何显示在 chrome 通知中?
它从未显示为敬酒。
相反,它直接进入系统托盘中的通知列表。正常(优先级 >= 0)通知会在几秒钟后从屏幕上消失,并且也会添加到该列表中。
用户收到的唯一提醒是响铃图标亮起。
我不确定优先级 -1 和 -2 之间有什么区别。至少它会影响通知的顺序,但可能 -2 也不会使通知图标处于活动状态。需要测试 - 文档非常缺乏。
在我看来是这样的:
var message = 'Hello world!';
var title = 'Hello world!';
var notificationOptions = {
type: 'basic',
title: title,
message: message,
iconUrl: chrome.extension.getURL('assets/images/icon-32.png'),
priority: -1
};
chrome.notifications.create(
'my_notification',
'my_notification_id',
notificationOptions,
function() {}
);
永远不会显示。原因是优先级:-1。那么负面优先级的真正含义是什么以及它们如何显示在 chrome 通知中?
它从未显示为敬酒。
相反,它直接进入系统托盘中的通知列表。正常(优先级 >= 0)通知会在几秒钟后从屏幕上消失,并且也会添加到该列表中。
用户收到的唯一提醒是响铃图标亮起。
我不确定优先级 -1 和 -2 之间有什么区别。至少它会影响通知的顺序,但可能 -2 也不会使通知图标处于活动状态。需要测试 - 文档非常缺乏。