notifications 编辑
Display notifications to the user, using the underlying operating system's notification mechanism. Because this API uses the operating system's notification mechanism, the details of how notifications appear and behave may differ according to the operating system and the user's settings.
To use this API you need to have the "notifications" permission.
The notification looks the same on all desktop operating systems. Something like:
Types
notifications.NotificationOptions
- Defines the content of a notification.
notifications.TemplateType
- The type of notification. For example, this defines whether the notification can contain an image.
Functions
notifications.clear()
- Clear a specific notification, given its ID.
notifications.create()
- Create and display a new notification.
notifications.getAll()
- Get all notifications.
notifications.update()
- Update a notification.
Events
notifications.onButtonClicked
- Fired when the user clicked a button in the notification.
notifications.onClicked
- Fired when the user clicked the notification, but not on a button.
notifications.onClosed
- Fired when a notification closed, either by the system or because the user dismissed it.
notifications.onShown
- Fired immediately after a notification has been shown.
Browser compatibility
BCD tables only load in the browser
Example extensions
AcknowledgementsThis API is based on Chromium's chrome.notifications
API.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论