Key
constKey:object
Defined in: client/api.d.ts:2500
Client-only, resource-owned physical key bindings exposed as the global Key.
Type Declaration
Section titled “Type Declaration”bind()
Section titled “bind()”bind(
key,stateOrHandler,handler?):boolean
Binds a resource-owned handler that fires while the game has foreground input and no UI is capturing it.
Parameters
Section titled “Parameters”string
Case-insensitive supported keyboard or mouse key name.
stateOrHandler
Section titled “stateOrHandler”"down" | "up" | KeyHandler | "both"
Trigger state, or the handler itself to use the default down state.
handler?
Section titled “handler?”KeyHandler
Handler required when an explicit trigger state is provided.
Returns
Section titled “Returns”boolean
True after the binding is installed; invalid keys or states throw.
isDown()
Section titled “isDown()”isDown(
key):boolean
Queries live physical key state using the same foreground and UI-input gate as binding dispatch.
Parameters
Section titled “Parameters”string
Case-insensitive supported key name.
Returns
Section titled “Returns”boolean
False when the key is up, the game is backgrounded, UI owns input, or the key name is invalid.
unbind()
Section titled “unbind()”unbind(
key,state?,handler?):boolean
Removes matching bindings owned by the calling resource; omitting filters removes every binding for the key.
Parameters
Section titled “Parameters”string
Case-insensitive supported key name.
state?
Section titled “state?”"down" | "up" | "both"
Optional trigger-state filter.
handler?
Section titled “handler?”KeyHandler
Optional exact handler filter.
Returns
Section titled “Returns”boolean
True when at least one binding was removed.
