runtime.requestUpdateCheck()
Checks to see if an update for the extension is available.
This is an asynchronous function that returns a Promise
.
Syntax
js
let requestingCheck = browser.runtime.requestUpdateCheck()
Parameters
None.
Return value
A Promise
that will be fulfilled with two arguments:
status
-
A
runtime.RequestUpdateCheckStatus
value — the result of the update check. details
Optional-
object
. Ifstatus
isupdate_available
, this contains more information about the update. It is an object containing a single property:version
-
string
. The update's version.
Browser compatibility
BCD tables only load in the browser
Examples
Request an update, and log the new version if one is available:
js
function onRequested(status, details) {
console.log(status);
if (status === "update_available") {
console.log(details.version);
}
}
function onError(error) {
console.log(`Error: ${error}`);
}
let requestingCheck = browser.runtime.requestUpdateCheck(onRequested);
requestingCheck.then(onRequested, onError);
Note: This API is based on Chromium's chrome.runtime
API. This documentation is derived from runtime.json
in the Chromium code.