alarms
在未来一个特定的时间运行的计划任务代码。这很像setTimeout()
(en-US)和setInterval()
(en-US),不过这些函数仅可以按需使用而不能在后台页面工作。
想要使用这个 API,您需要获取"alarms"的permission。
类型
alarms.Alarm
(en-US)-
Information about a particular alarm.
方法
alarms.create()
-
创建新的 alarm.
alarms.get()
(en-US)-
通过名称获取指定的 alarm.
alarms.getAll()
(en-US)-
获取所有的 alarm.
alarms.clear()
(en-US)-
清除指定名称的 alarm.
alarms.clearAll()
(en-US)-
清除所有的 alarm.
事件
alarms.onAlarm
(en-US)-
当 alarm 发生的时候触发。
浏览器兼容性
BCD tables only load in the browser
备注: The "Chrome incompatibilities" section is included from https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities using the WebExtChromeCompat macro.
If you need to update this content, edit https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities, then shift-refresh this page to see your changes.
Example extensions
备注: This API is based on Chromium's chrome.alarms
API.
Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.