Skip to content

Commit

Permalink
WebExt: fix typo (#37091)
Browse files Browse the repository at this point in the history
* fix typo

* update code example and description

* minor improvements

* Apply suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update files/en-us/mozilla/add-ons/webextensions/api/management/uninstall/index.md

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update index.md

* Apply suggestions from code review

Co-authored-by: rebloor <[email protected]>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: rebloor <[email protected]>
  • Loading branch information
3 people authored Dec 16, 2024
1 parent 76b66b9 commit c9bad2e
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 c9bad2e

Please sign in to comment.