notifications.clear()

Clears a notification, given its ID.

Syntax

browser.notifications.clear(
  id,                            // string
  function(wasCleared) {...}     // optional function
)

Parameters

id
string. The ID of the notification to clear. This is the same as the ID passed into notifications.create()'s callback.
callbackOptional
function. The function is passed the following arguments:
wasCleared
boolean. true if the notification was cleared, or false if it was not (for example, because the notification referenced by id did not exist).

Browser compatibility

EdgeFirefoxChromeOpera
Basic support?45.0Yes33
Firefox
Basic support48.0

Examples

Acknowledgements

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

Document Tags and Contributors

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