Jo *_* E. 2 javascript web-notifications electron
如何在Electron App上实现Notification API?
我试过检查Notification.permission然后返回granted
但是当我尝试运行时:
new Notification("FOO", {body:"FOOOOOOOOOOOOOOOOOOOOOOOOO"});
什么都没发生.它甚至支持吗?
注意:由于这是一个 HTML5 API,它仅在渲染器进程中可用。
例子 :
let myNotification = new Notification('Title', {
body: 'Lorem Ipsum Dolor Sit Amet'
})
myNotification.onclick = () => {
console.log('Notification clicked')
}
Run Code Online (Sandbox Code Playgroud)
视窗
在 Windows 10 上,通知“正常工作”。
在 Windows 8.1 和 Windows 8 上,必须在“开始”屏幕上安装带有应用程序用户模型 ID 的应用程序快捷方式。但是请注意,它不需要固定到“开始”屏幕。
在 Windows 7 上,不支持通知。但是,您可以使用 Tray API 发送“气球通知”。
此外,通知正文的最大长度为 250 个字符,Windows 团队建议通知应保持为 200 个字符。
更多信息:https : //github.com/electron/electron/blob/master/docs/tutorial/desktop-environment-integration.md#notifications-windows-linux-os-x
通知 API 不适用于 Windows,因为没有适用于所有版本 Windows 的通知 API(实际上,Win10 是第一个桌面版本有记录的 API,Win8.x 有,但仅限 WinRT )
| 归档时间: |
|
| 查看次数: |
9829 次 |
| 最近记录: |