Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mohamedkhallouq
GitHub Repository: mohamedkhallouq/content
Path: blob/main/files/en-us/mozilla/add-ons/webextensions/api/management/oninstalled/index.md
6567 views
---
title: management.onInstalled() slug: Mozilla/Add-ons/WebExtensions/API/management/onInstalled page-type: webextension-api-event tags: - API - Add-ons - Event - Reference - WebExtensions - management - onInstalled browser-compat: webextensions.api.management.onInstalled
---

{{AddonSidebar()}}

Fired when an add-on is installed.

This API requires the "management" API permission.

Syntax

browser.management.onInstalled.addListener(listener) browser.management.onInstalled.removeListener(listener) browser.management.onInstalled.hasListener(listener)

Events have three functions:

  • addListener(callback)

    • : Adds a listener to this event.

  • removeListener(listener)

    • : Stop listening to this event. The listener argument is the listener to remove.

  • hasListener(listener)

    • : Checks whether a listener is registered for this event. Returns true if it is listening, false otherwise.

addListener syntax

Parameters

  • function

    • : Callback function that will be called when this event occurs. The function will be passed the following argument:

Browser compatibility

{{Compat}}

Examples

Log the names of add-ons when they are installed:

browser.management.onInstalled.addListener((info) => { console.log(`${info.name} was installed`); });

{{WebExtExamples}}

Note: This API is based on Chromium's chrome.management API. This documentation is derived from management.json in the Chromium code.