Class: PressState

PressState()

new PressState()

Press state tracking for input controls
Source:

Methods

getDuration(id) → {number}

Gets the duration the given id was held down
Parameters:
Name Type Description
id string | number The identifier to check
Source:
Returns:
The duration in milliseconds
Type
number

isDown(id) → {boolean}

Checks if the given id is currently down
Parameters:
Name Type Description
id string | number The identifier to check
Source:
Returns:
True if down, false otherwise
Type
boolean

isLongPressed(id) → {boolean}

Checks if the given id was a long press
Parameters:
Name Type Description
id string | number The identifier to check
Source:
Returns:
True if it was a long press, false otherwise
Type
boolean

isPressed(id) → {boolean}

Checks if the given id was a short press
Parameters:
Name Type Description
id string | number The identifier to check
Source:
Returns:
True if it was a short press, false otherwise
Type
boolean

isUp(id) → {boolean}

Checks if the given id is currently up
Parameters:
Name Type Description
id string | number The identifier to check
Source:
Returns:
True if up, false otherwise
Type
boolean

update()

Updates the press state, clearing any completed states
Source: