Skip to content

Commit

Permalink
Merge branch 'main' into mousePointerCrosslinks
Browse files Browse the repository at this point in the history
  • Loading branch information
allan-bonadio authored Dec 16, 2024
2 parents 4b09459 + c9bad2e commit 5b50a7b
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,33 @@ let uninstalling = browser.management.uninstall(
<!---->

- If `id` is the calling add-on's ID, `showConfirmDialog` defaults to `false`.
- If `id` is a the ID of a different add-on, the `showConfirmDialog` option is ignored and the confirmation dialog is always shown.
- If `id` is the ID of a different add-on, the `showConfirmDialog` option is ignored and the confirmation dialog is always shown.

### Return value

A [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that will be rejected with an error message if the user canceled uninstall.
A [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that will be rejected with an error message if the user canceled the uninstallation.

## Browser compatibility

{{Compat}}

## Examples

Uninstall the add-on whose ID is "my-addon-id", asking the user to confirm. In the callback, check whether the user canceled uninstallation.

Note that we haven't passed a fulfillment handler because if uninstallation succeeds, the add-on is no longer around to handle it.
Uninstall the add-on whose ID is "addon-id" and ask the user to confirm. In the callback, we check whether the user canceled the uninstallation or if the operation succeeded.

```js
let id = "my-addon-id";
let id = "addon-id";

function onCanceled(error) {
console.log(`Uninstall canceled: ${error}`);
console.log(`Canceled: ${error}`);
}

function onUninstalled() {
console.log("Uninstalled");
}

let uninstalling = browser.management.uninstall(id);
uninstalling.then(null, onCanceled);
uninstalling.then(onUninstalled, onCanceled);
```

{{WebExtExamples}}
Expand Down

0 comments on commit 5b50a7b

Please sign in to comment.