userScripts API

Note

A manifest entry named user_scripts is required to use messenger.userScripts.*.

Events

onBeforeScript

Event called when a new userScript global has been created

Parameters for onBeforeScript.addListener(listener)

listener(userScript)

A function that will be called when this event occurs.

Parameters passed to the listener function

userScript

(object)

defineGlobals

(function)

Exports all the properties of a given plain object as userScript globals

export

(function)

Convert a given value to make it accessible to the userScript code

global

(any)

The userScript global

metadata

(any)

The userScript metadata (as set in userScripts.register)