onMouseEvents([callback], [remove])

Class: MenuBar. Method inherited from UIComponent.

Description:

Gets, registers or unregisters a mouse buttons event handler function.

Parameters:

Name Type Default Description

[callback]

function

The event handler function that receives a MouseEvent object. Pass null to unregister all handler functions.

[remove]

boolean

false

Set to true to unregister the event handler.

Returns:

An array of handler functions if no arguments are passed, otherwise this component for method chaining.

Type: this | Array.<function()>

Examples:

// Example event object:
const e = {
  target: object,    // The component that triggered the event.
  type: string,      // `click`, `down`, `up`, `enter`, or `leave`.
  button: number,    // Button number. One of MouseButton enum values.
  clicks: number,    // Amount of time the click happened. Present when applicable.
  modifiers: number, // Keyboard modifiers (bitmask or flags).
  alt: boolean,      // Indicates if ALT key was pressed.
  shift: boolean,    // Indicates if SHIFT key was pressed.
  ctrl: boolean,     // Indicates if CTRL key was pressed.
  x: number,         // Present when applicable.
  y: number,         // Present when applicable.
  screenX: number,   // Present when applicable.
  screenY: number,   // Present when applicable.
};

Also See: