这篇翻译不完整。请帮忙从英语翻译这篇文章

在未来一个特定的时间运行的计划任务代码。这很像setTimeout()setInterval(),不过这些函数仅可以按需使用而不能在后台页面工作。

想要使用这个API,您需要获取"alarms"的permission

类型

alarms.Alarm
Information about a particular alarm.

方法

alarms.create()
创建新的alarm.
alarms.get()
通过名称获取指定的alarm.
alarms.getAll()
获取所有的alarm.
alarms.clear()
清除指定名称的alarm.
alarms.clearAll()
清除所有的alarm.

事件

alarms.onAlarm
当alarm发生的时候触发.

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxOperaFirefox for Android
AlarmChrome Full support YesEdge No support NoFirefox Full support 45Opera Full support YesFirefox Android Full support 48
clearChrome Full support YesEdge No support NoFirefox Full support 45Opera Full support YesFirefox Android Full support 48
clearAllChrome Full support YesEdge No support NoFirefox Full support 45Opera Full support YesFirefox Android Full support 48
createChrome Full support YesEdge No support NoFirefox Full support 45Opera Full support YesFirefox Android Full support 48
getChrome Full support YesEdge No support NoFirefox Full support 45Opera Full support YesFirefox Android Full support 48
getAllChrome Full support YesEdge No support NoFirefox Full support 45Opera Full support YesFirefox Android Full support 48
onAlarmChrome Full support YesEdge No support NoFirefox Full support 45Opera Full support YesFirefox Android Full support 48

Legend

Full support  
Full support
No support  
No support

Chrome incompatibilities

None.

Example extensions

Acknowledgements

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.

文档标签和贡献者

此页面的贡献者: abcqdsdchina, popcorner
最后编辑者: abcqdsdchina,