Control: {
    buttons: Button | Button[];
    halt?: boolean;
    on_down?: Function;
    on_up?: Function;
    params?: {
        loop_time?: number;
        reset_controls?: boolean;
    };
    sfx?: {
        down?: string | (() => string);
        up?: string | (() => string);
    };
}

Type declaration

  • buttons: Button | Button[]

    The button that will fire the callbacks. If it's an array, the buttons will be tested if pressed in order.

  • Optional halt?: boolean

    Stop propagation of the event, blocking the dispatch to next listener on the queue. Does not work for loops.

  • Optional on_down?: Function
  • Optional on_up?: Function
  • Optional params?: {
        loop_time?: number;
        reset_controls?: boolean;
    }
    • Optional loop_time?: number

      Time between each trigger on button held

    • Optional reset_controls?: boolean

      Will reset all controls that were set together upon this button press. Double check it usage when "no_initial_reset" was set to true in further controls. Only works if "persist" is false.

  • Optional sfx?: {
        down?: string | (() => string);
        up?: string | (() => string);
    }
    • Optional down?: string | (() => string)

      The sfx to be played on key down. You can also pass a function the returns the sfx key.

    • Optional up?: string | (() => string)

      The sfx to be played on key up. You can also pass a function the returns the sfx key.