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
isTapped(id) → {boolean}
Checks if the given id went down since the last update, even if it has been released since
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | number | The identifier to check |
- Source:
Returns:
True if it was pressed since the last update, 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
releaseAll()
Releases every held id, for example when the window loses focus
- Source:
update()
Updates the press state, clearing any completed states and taps
- Source: