【发布时间】:2013-05-22 09:01:57
【问题描述】:
我的 Chrome 扩展程序大量使用了 webkitNotifications。我想切换到new rich notifications (chrome.notifications),但这些还不是在所有平台上都可用,目前仅在 beta 通道及更高版本中编写。如果丰富的通知不可用,则应使用 webkitNotifications 作为后备。因此,我正在寻找实现这一点的最佳解决方案:
if(richNotificationsAvailable())
chrome.notifications.create(...);
else
webkitNotifications.createNotification(...).show();
我尝试检查 chrome.notifications.create 是否未定义,但它甚至是为 Chrome 27 定义的,在 chrome://flags 中禁用了丰富的通知。
【问题讨论】:
标签: google-chrome-extension rich-notifications