runtime.onUpdateAvailable

Fired when an update is available, but isn't installed immediately because the app is currently running. If you do nothing, the update will be installed the next time the background page gets unloaded, if you want it to be installed sooner you can explicitly call runtime.reload. If your extension is using a persistent background page, the background page of course never gets unloaded, so unless you call runtime.reload manually in response to this event the update will not get installed until the next time the browser itself restarts. If no handlers are listening for this event, and your extension has a persistent background page, it behaves as if runtime.reload is called in response to this event.

Syntax

browser.runtime.onUpdateAvailable.addListener(function(
  details // object
) {...})
browser.runtime.onUpdateAvailable.removeListener(listener)
browser.runtime.onUpdateAvailable.hasListener(listener)

Events have three functions:

addListener(callback)
Adds a listener to this event.
removeListener(listener)
Stop listening to this event. The listener argument is the listener to remove.
hasListener(listener)
Check whether listener is registered for this event. Returns true if it is listening, false otherwise.

addListener syntax

Parameters

callback

Function that will be called when this event occurs. The function will be passed the following arguments:

details
object. The manifest details of the available update.

Additional objects

details

The manifest details of the available update.

version
string. The version number of the available update.

Browser compatibility

EdgeFirefoxChromeOpera
Basic support?NoYes33
Firefox
Basic supportNo

Examples

Acknowledgements

This API is based on Chromium's chrome.runtime API. This documentation is derived from runtime.json in the Chromium code.

Document Tags and Contributors

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