/
index.md
45 lines (29 loc) · 1.03 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
title: alarms.clearAll()
slug: Mozilla/Add-ons/WebExtensions/API/alarms/clearAll
page-type: webextension-api-function
browser-compat: webextensions.api.alarms.clearAll
---
{{AddonSidebar}}
Cancels all active alarms.
This is an asynchronous function that returns a [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
## Syntax
```js-nolint
let clearAlarms = browser.alarms.clearAll()
```
### Parameters
None.
### Return value
A [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that will be fulfilled with a boolean. This will be `true` if any alarms were cleared, `false` otherwise. Note that Chrome always passes `true` here.
## Examples
```js
function onClearedAll(wasCleared) {
console.log(wasCleared); // true/false
}
let clearAlarms = browser.alarms.clearAll();
clearAlarms.then(onClearedAll);
```
{{WebExtExamples}}
## Browser compatibility
{{Compat}}
> **Note:** This API is based on Chromium's [`chrome.alarms`](https://developer.chrome.com/docs/extensions/reference/alarms/) API.