android-components / mozilla.components.support.webextensions / WebExtensionSupport / initialize

initialize

fun initialize(runtime: WebExtensionRuntime, store: BrowserStore, openPopupInTab: Boolean = false, onNewTabOverride: (WebExtension?, EngineSession, String) -> String = null, onCloseTabOverride: (WebExtension?, String) -> Unit = null, onSelectTabOverride: (WebExtension?, String) -> Unit = null, onUpdatePermissionRequest: onUpdatePermissionRequest? = { _, _, _, _ -> }, onExtensionsLoaded: (List<WebExtension>) -> Unit = null): Unit (source)

Registers a listener for web extension related events on the provided WebExtensionRuntime and reacts by dispatching the corresponding actions to the provided BrowserStore.

Parameters

runtime - the browser WebExtensionRuntime to use.

store - the application’s BrowserStore.

openPopupInTab - (optional) flag to determine whether a browser or page action would display a web extension popup in a tab or not. Defaults to false.

onNewTabOverride - (optional) override of behaviour that should be triggered when web extensions open a new tab e.g. when dispatching to the store isn’t sufficient while migrating from browser-session to browser-state. This is a lambda accepting the WebExtension, the EngineSession to use, as well as the URL to load, return the ID of the created session.

onCloseTabOverride - (optional) override of behaviour that should be triggered when web extensions close tabs e.g. when dispatching to the store isn’t sufficient while migrating from browser-session to browser-state. This is a lambda accepting the WebExtension and the session/tab ID to close.

onSelectTabOverride - (optional) override of behaviour that should be triggered when a tab is selected to display a web extension popup. This is a lambda accepting the WebExtension and the session/tab ID to select.

onUpdatePermissionRequest - (optional) Invoked when a web extension has changed its permissions while trying to update to a new version. This requires user interaction as the updated extension will not be installed, until the user grants the new permissions.

onExtensionsLoaded - (optional) callback invoked when the extensions are loaded by the engine. Note that the UI (browser/page actions etc.) may not be initialized at this point.