Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Keybind

Index

Constructors

Methods

Constructors

constructor

  • new Keybind(keyCode: KeyCode | KeyCode[], callback: () => void, eventType?: "keyup" | "keydown"): Keybind
  • Binds a callback to a specific key or multiple keys.

    example
    // two keycodes (similar to two separate keybinds with the same handler)
    const bind = new alt.Utils.Keybind([KeyCode.G, KeyCode.H], () => {
      alt.log('pressed G or H')
    })
    

    Parameters

    • keyCode: KeyCode | KeyCode[]

      Single or multiple keys to bind.

    • callback: () => void

      Function to call.

        • (): void
        • Returns void

    • Optional eventType: "keyup" | "keydown"

      On which event callback should be called. Defaults to "keyup".

    Returns Keybind

Methods

destroy

  • destroy(): void
  • Returns void