Skip to main content

reporting.lifecycle

Manage the lifecycle of your extension. Generally used to add and remove event listeners.

addEventListener()

addEventListener<T>(eventType, callback): void

Run a function whenever an event occurs.

Note that the event passed to your callback depends on the eventType you've provided. For example, if you use the "report-updated" event type, you'll receive a ReportUpdated event.

Type Parameters

Type Parameter
T extends "confirm-response" | "fix-click" | "report-closed" | "report-opened" | "report-updated" | "button-click" | "text-input-change"

Parameters

ParameterTypeDescription
eventTypeTThe type of event you want to respond to.
callback(event) => voidThe function called whenever the eventType you've specified fires.

Returns

void


removeEventListener()

removeEventListener<T>(eventType, callback): void

Stop running a specific function for an event occurrence.

To see an example of this, please check out the When Did I Start on Reports example.

Type Parameters

Type Parameter
T extends "confirm-response" | "fix-click" | "report-closed" | "report-opened" | "report-updated" | "button-click" | "text-input-change"

Parameters

ParameterTypeDescription
eventTypeTThe type of event you want to remove your listener from.
callback(event) => voidThe same function you've passed to addEventListener. To use this, you cannot use an anonymous callback for addEventListener, you must define the function separately.

Returns

void