Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

alarms.clear()

Cancels an alarm, given its name.

Syntax

chrome.alarms.clear(
  name,                        // string
  function(wasCleared) {...}   // function
)

This API is also available as browser.alarms.clear() in a version that returns a promise.

Parameters

nameOptional
string. The name of the alarm to clear. If you don't supply this, the empty string "" will be used.
callbackOptional
function. The function is passed the following arguments:
wasCleared
boolean. true if the alarm was cleared, false otherwise.

Browser compatibility

Chrome Edge Firefox Firefox for Android Opera
Basic Support Yes No 45.0 48.0 33

Examples

Callback-based version:

function onCleared(wasCleared) {
  console.log(wasCleared); // true/false
}

chrome.alarms.clear("my-periodic-alarm", onCleared);

Promise-based version:

function onCleared(wasCleared) {
  console.log(wasCleared);  // true/false
}

var clearAlarm = browser.alarms.clear("my-periodic-alarm");
clearAlarm.then(onCleared);

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.

Document Tags and Contributors

 Contributors to this page: Makyen, wbamberg
 Last updated by: Makyen,