Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

constructor

  • new Button(id: number): Button

Properties

Private _isPressed

_isPressed: boolean = false

Private _pressedAt

_pressedAt: number = 0

Readonly id

id: number

Static prefixed

prefixed: string | boolean

Accessors

duration

  • get duration(): number

isPressed

  • get isPressed(): boolean

Methods

addListener

emit

  • emit<K>(event: K, ...args: Record<ButtonEvent, [event?: MouseEvent, duration?: number]>[K]): boolean

eventNames

  • eventNames(): (string | symbol)[]
  • Return an array listing the events for which the emitter has registered listeners.

    Returns (string | symbol)[]

handle

isMineEvent

  • isMineEvent(event: MouseEvent): boolean

listenerCount

  • listenerCount(event: string | symbol): number
  • Return the number of listeners listening to a given event.

    Parameters

    • event: string | symbol

    Returns number

listeners

  • Return the listeners registered for a given event.

    Parameters

    • event: string | symbol

    Returns ListenerFn[]

off

  • off(event: string | symbol, fn?: ListenerFn, context?: any, once?: boolean): Button
  • Parameters

    • event: string | symbol
    • Optional fn: ListenerFn
    • Optional context: any
    • Optional once: boolean

    Returns Button

on

  • on<K>(event: K, fn: (...params: Record<ButtonEvent, [event?: MouseEvent, duration?: number]>[K]) => void, context?: any): Button
  • Add a listener for a given event.

    Type parameters

    • K: "dblclick" | "down" | "up"

    Parameters

    • event: K
    • fn: (...params: Record<ButtonEvent, [event?: MouseEvent, duration?: number]>[K]) => void
        • (...params: Record<ButtonEvent, [event?: MouseEvent, duration?: number]>[K]): void
        • Parameters

          • Rest ...params: Record<ButtonEvent, [event?: MouseEvent, duration?: number]>[K]

          Returns void

    • Optional context: any

    Returns Button

once

  • once<K>(event: K, fn: (...params: Record<ButtonEvent, [event?: MouseEvent, duration?: number]>[K]) => void, context?: any): Button
  • Add a one-time listener for a given event.

    Type parameters

    • K: "dblclick" | "down" | "up"

    Parameters

    • event: K
    • fn: (...params: Record<ButtonEvent, [event?: MouseEvent, duration?: number]>[K]) => void
        • (...params: Record<ButtonEvent, [event?: MouseEvent, duration?: number]>[K]): void
        • Parameters

          • Rest ...params: Record<ButtonEvent, [event?: MouseEvent, duration?: number]>[K]

          Returns void

    • Optional context: any

    Returns Button

removeAllListeners

  • removeAllListeners(event?: string | symbol): Button
  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: string | symbol

    Returns Button

removeListener

  • removeListener(event: string | symbol, fn?: ListenerFn, context?: any, once?: boolean): Button
  • Remove the listeners of a given event.

    Parameters

    • event: string | symbol
    • Optional fn: ListenerFn
    • Optional context: any
    • Optional once: boolean

    Returns Button

Generated using TypeDoc