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 is fulfilled with an object with the result of the update request.
result
-
An object with the following properties:
status
-
runtime.RequestUpdateCheckStatus
. The result of the update check. version
Optional-
string
. The update's version, ifstatus
isupdate_available
.
Examples
Request an update and log the new version if one is available:
js
function onRequested(result) {
console.log(result.status);
if (result.status === "update_available") {
console.log(result.version);
}
}
function onError(error) {
console.log(`Error: ${error}`);
}
let requestingCheck = browser.runtime.requestUpdateCheck();
requestingCheck.then(onRequested, onError);
Browser compatibility
BCD tables only load in the browser
Note: This API is based on Chromium's chrome.runtime
API. This documentation is derived from runtime.json
in the Chromium code.