JavaScript events

Event principles

JavaScript event handlers are called whenever an event of a specific type occurs.

Important: Unlike midiScript events, there are no filtering attributes that limit when an event triggers; for example, OnControlChangeReceived() event handlers in all scripts will be triggered every time a Control Change message is received. It is up to each script to decide whether to handle the specific command.

JavaScript is case-sensitive, but the plugin still tries to locate event handlers even when the case differs. If an event handler is not called even though it should be, please check the function name's case and verify that it matches what this documentation says; the case-insensitive search might fail for some reason.

Script initialization event

The script initialization event is triggered when the script is loaded, either when Stream Deck starts or when a profile/page/folder with the button/dial is loaded. 

Midi events

Midi events differentiate between commands received from an external source and commands sent from a Stream Deck button or dial. If you want your script to manage both sent and received commands, you need to create event handlers for each type.

Midi channels are always in the range 1-16, both in Midi event handlers and in midi actions. 

Events

Syntax

OnInit()

The OnInit() event is triggered once when the script is loaded.