Gets all active alarms for the extension.
This is an asynchronous function that returns a
Promise
.
var getAlarms = browser.alarms.getAll()
None.
A
Promise
that will be fulfilled with an array of
闹钟
objects. Each of these represents an active alarm that belongs to the extension. If no alarms are active, the array will be empty.
function gotAll(alarms) {
for
(
var
alarm
of
alarms
)
{
console
.
log
(
alarm
.
名称
)
;
}
}
var
getAlarms
=
浏览器
.
alarms
.
getAll
(
)
;
getAlarms
.
then
(
gotAll
)
;
BCD tables only load in the browser
注意:
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.
最后修改: , 由 MDN 贡献者