MDN self-hosted library · e01.org

runtime.requestUpdateCheck()

Checks to see if an update for the extension is available.

Open notebook · 1 cells webextension-api-function upstream source

Checks to see if an update for the extension is available.

This is an asynchronous function that returns a Promise.

Syntax

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

    • : string. The update's version, if status is update_available.

Examples

Request an update and log the new version if one is available:

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

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