alarms API
Hint
The alarms API is inherited from Firefox, and its primary documentation is maintained by Mozilla at MDN. Thunderbird implements only the subset of functions, events, and types listed here. The MDN pages may provide further details and examples, but they may also reference features that are not supported in Thunderbird.
Permissions
The following permissions influence the behavior of the API. Depending on which permissions are requested, additional methods might be available, or certain data may be included in responses.
Hint
Request permissions only when needed. Unnecessary requests may result in rejection during ATN review.
alarms
Grant access to some or all methods of the alarms API.
Functions
clear([name])
– [Added in TB 45]
Clears the alarm with the given name.
Parameters
name
The name of the alarm to clear. Defaults to the empty string.
Required permissions
clearAll()
– [Added in TB 45]
Clears all alarms.
Required permissions
create([name], alarmInfo)
– [Added in TB 45]
Creates an alarm. After the delay is expired, the onAlarm event is fired. If there is another alarm with the same name (or no name if none is specified), it will be cancelled and replaced by this alarm.
Parameters
name
Optional name to identify this alarm. Defaults to the empty string.
alarmInfo
Details about the alarm. The alarm first fires either at ‘when’ milliseconds past the epoch (if ‘when’ is provided), after ‘delayInMinutes’ minutes from the current time (if ‘delayInMinutes’ is provided instead), or after ‘periodInMinutes’ minutes from the current time (if only ‘periodInMinutes’ is provided). Users should never provide both ‘when’ and ‘delayInMinutes’. If ‘periodInMinutes’ is provided, then the alarm recurs repeatedly after that many minutes.
delayInMinutes
Number of minutes from the current time after which the alarm should first fire.
periodInMinutes
Number of minutes after which the alarm should recur repeatedly.
when
Time when the alarm is scheduled to first fire, in milliseconds past the epoch.
Required permissions
get([name])
– [Added in TB 45]
Retrieves details about the specified alarm.
Parameters
name
The name of the alarm to get. Defaults to the empty string.
Required permissions
getAll()
– [Added in TB 45]
Gets an array of all the alarms.
Required permissions
Events
onAlarm
– [Added in TB 45]
Fired when an alarm has expired. Useful for transient background pages.
Parameters for onAlarm.addListener(listener)
listener(name)
A function that will be called when this event occurs.
Required permissions
Types
Alarm
– [Added in TB 45]