notifications.onButtonClicked
当用户点击通知的按钮时触发。
语法
js
browser.notifications.onButtonClicked.addListener(listener)
browser.notifications.onButtonClicked.removeListener(listener)
browser.notifications.onButtonClicked.hasListener(listener)
事件有三个函数:
addListener(listener)
-
添加一个监听器到这个事件。
removeListener(listener)
-
停止监听这个事件。
listener
参数是要移除的监听器。 hasListener(listener)
-
检查
listener
是否已注册到这个事件。若在监听,返回true
,否则返回false
。
addListener 语法
参数
listener
-
当这个事件发生时调用的函数。这个函数会接收以下参数:
notificationId
-
string
。被点击按钮的通知的 ID。 -
integer
。被点击按钮的从零开始的索引。
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | ||||||
---|---|---|---|---|---|---|---|
onButtonClicked |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
备注:
该 API 基于 Chromium 的 chrome.notifications
API。