我的Chrome扩展程序大量使用了webkitNotifications.我想切换到新的富通知(chrome.notifications),但这些通知尚未在所有平台上提供,而且仅在beta频道和更高版本中编写.如果富通知不可用,则应将webkitNotifications用作后备.因此,我正在寻找实现这个的最佳解决方案:
if(richNotificationsAvailable())
chrome.notifications.create(...);
else
webkitNotifications.createNotification(...).show();
Run Code Online (Sandbox Code Playgroud)
我尝试检查chrome.notifications.create未定义但是甚至为Chrome 27定义了禁用了丰富的通知chrome://flags.