script.addListener

addListener<K>(event, listener): void

Add an event listener to the script.

Type Parameters

K

K extends keyof EventMap

Parameters

event

K

event - The event to listen to.

listener

(e) => void

listener - The function to call when the event is fired.

Returns

void

Remarks

This can only be used while the script is initializing.

Example

Last updated