Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google chrome 以优先级显示的Chrome扩展通知(Chrome.notifications)的行为是什么<;0?_Google Chrome_Google Chrome Extension - Fatal编程技术网

Google chrome 以优先级显示的Chrome扩展通知(Chrome.notifications)的行为是什么<;0?

Google chrome 以优先级显示的Chrome扩展通知(Chrome.notifications)的行为是什么<;0?,google-chrome,google-chrome-extension,Google Chrome,Google Chrome Extension,在我看来,像这样的事情: 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.notifica

在我看来,像这样的事情:

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通知中是如何显示的呢?

它从来不会作为祝酒词显示出来

相反,它直接进入systray中的通知列表。正常(优先级>=0)通知会在几秒钟后从屏幕上消失,并添加到该列表中

用户得到的唯一警告是铃声图标亮起


我不确定优先级-1和-2之间有什么区别。它至少会影响通知的顺序,但-2可能也不会使通知图标处于活动状态。需要测试-文档非常缺乏。

所说的“在我看来……永远不会显示”是指您已经测试并观察到了行为,还是您预期会发生这种情况?这就是我已经测试并观察到的。有趣。他们在OSX上会去哪里?我在操作系统的通知窗格中看不到任何内容。它没有集成在操作系统级别的通知中心中,而是独立的。看看指示灯区域,没错。我在我的OSX“托盘”(时间左边的区域)中发现了一个“铃声”图标,它就在那里,我的-1通知!谢谢