Skip to main content

Class: KeyEventManager

Defined in: src/sdk/data/KeyEventManager.ts:33

A manager for key events. Allows key events to be triggered and intercepted, and also publishes intercepted key events on the event bus.

Methods

interceptKey()

interceptKey(key, passThrough): void

Defined in: src/sdk/data/KeyEventManager.ts:81

Enables interception for a key.

Parameters

ParameterTypeDescription
keystringThe key to intercept.
passThroughbooleanWhether to pass the event through to the sim after it has been intercepted.

Returns

void


triggerKey()

triggerKey(key, bypass, value0, value1, value2): Promise<void>

Defined in: src/sdk/data/KeyEventManager.ts:72

Triggers a key event.

Parameters

ParameterTypeDefault valueDescription
keystringundefinedThe key to trigger.
bypassbooleanundefinedWhether the event should bypass intercepts.
value0number0The first data value of the key event. Defaults to 0.
value1number0The second data value of the key event. Defaults to 0.
value2number0The third data value of the key event. Defaults to 0.

Returns

Promise<void>

A Promise which is fulfilled after the key event has been triggered.


getManager()

static getManager(bus): Promise<KeyEventManager>

Defined in: src/sdk/data/KeyEventManager.ts:90

Gets an instance of KeyEventManager. If an instance does not already exist, a new one will be created.

Parameters

ParameterTypeDescription
busEventBusThe event bus.

Returns

Promise<KeyEventManager>

A Promise which will be fulfilled with an instance of KeyEventManager.