alarms.clear()

Cancels an alarm, given its name.

Syntax

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

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

EdgeFirefoxChromeOpera
Basic support?45.0Yes33
Firefox
Basic support48.0

Examples

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

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

Acknowledgements

This API is based on Chromium's chrome.alarms API.

Document Tags and Contributors

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