Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EventKeyboard

The keyboard event.

Hierarchy

Index

Constructors

constructor

  • newEventKeyboard(keyCode: number | KeyboardEvent, isPressed: boolean, bubbles?: undefined | false | true): EventKeyboard
  • Parameters

    • keyCode: number | KeyboardEvent

      The key code of the current key or the DOM KeyboardEvent

    • isPressed: boolean

      Indicates whether the current key is being pressed

    • Optional bubbles: undefined | false | true

      Indicates whether the event bubbles up through the hierarchy or not.

    Returns EventKeyboard

Properties

bubbles

bubbles: boolean

Indicate whether the event bubbles up through the hierarchy or not.

currentTarget

currentTarget: Object | null = null

A reference to the currently registered target for the event.

eventPhase

eventPhase: number = 0

Indicates which phase of the event flow is currently being evaluated. Returns an integer value represented by 4 constants:

  • Event.NONE = 0
  • Event.CAPTURING_PHASE = 1
  • Event.AT_TARGET = 2
  • Event.BUBBLING_PHASE = 3 The phases are explained in the [section 3.1, Event dispatch and DOM event flow] markdown, of the DOM Level 3 Events specification.

isPressed

isPressed: boolean

Indicates whether the current key is being pressed

keyCode

keyCode: number

The keyCode read-only property represents a system and implementation dependent numerical code identifying the unmodified value of the pressed key. This is usually the decimal ASCII (RFC 20) or Windows 1252 code corresponding to the key. If the key can't be identified, this value is 0.

propagationImmediateStopped

propagationImmediateStopped: boolean = false

Stops propagation for current event immediately, the event won't even be dispatched to the listeners attached in the current target.

propagationStopped

propagationStopped: boolean = false

Stops propagation for current event.

Optional rawEvent

rawEvent: KeyboardEvent

Raw DOM KeyboardEvent.

target

target: Object | null = null

A reference to the target to which the event was originally dispatched.

type

type: string

The name of the event (case-sensitive), e.g. "click", "fire", or "submit".

Static ACCELERATION

ACCELERATION: string = "acceleration"

The type code of Acceleration event.

Static AT_TARGET

AT_TARGET: number = 2

The target phase comprises only the event target node [markdown] (http://www.w3.org/TR/DOM-Level-3-Events/#event-flow)

Static BUBBLING_PHASE

BUBBLING_PHASE: number = 3

The bubbling phase comprises any subsequent nodes encountered on the return trip to the root of the hierarchy [markdown] (http://www.w3.org/TR/DOM-Level-3-Events/#event-flow)

Static CAPTURING_PHASE

CAPTURING_PHASE: number = 1

The capturing phase comprises the journey from the root to the last node before the event target's node markdown

Static KEYBOARD

KEYBOARD: string = "keyboard"

The type code of Keyboard event.

Static MOUSE

MOUSE: string = "mouse"

The type code of Mouse event.

Static NONE

NONE: number = 0

Events not currently dispatched are in this phase.

Static NO_TYPE

NO_TYPE: string = "no_type"

Code for event without type.

Static TOUCH

TOUCH: string = "touch"

The type code of Touch event.

Methods

getCurrentTarget

  • getCurrentTarget(): null | Object
  • Gets current target of the event
    note: It only be available when the event listener is associated with node.
    It returns 0 when the listener is associated with fixed priority.

    Returns null | Object

    • The target with which the event associates.

getType

  • getType(): string

isStopped

  • isStopped(): boolean

reuse

  • reuse(type: string, bubbles?: undefined | false | true): void
  • Reinitialize the event for being used again after retrieved from the object pool.

    Parameters

    • type: string

      The name of the event (case-sensitive), e.g. "click", "fire", or "submit"

    • Optional bubbles: undefined | false | true

      A boolean indicating whether the event bubbles up through the tree or not

    Returns void

unuse

  • unuse(): void

Generated using TypeDoc