Help Center

Local Navigation

Object: Event

Availability

BlackBerry® Device Software version 4.6 or later

Extended by

CustomEvent, MutationEvent, UIEvent

The Event object represents provides contextual information about an event that Event handlers can use, such as the originating element, what stage the event is currently in within the event system, and so forth.

The properties and methods exposed by Event are minimal, and provide the basic functionality required by events of all types. More specific event objects should be used to acquire context information specific to a certain event type.

For example, the MouseEvent object, which inherits from Event through the UIEvent object, supplies additional properties supplying information such as the MouseEvent.button, MouseEvent.screenX and MouseEvent.screenY for where the current mouse event took place.

Event properties

Property name

Type

Description

Status

Availability

bubbles

boolean

When true, the event is a bubbling event.

read only

4.6. or later

cancelable

boolean

When true, the action of the event can be cancelled using Event.preventDefault() .

read only

4.6. or later

cancelBubble

boolean

When true, bubbling of the event is cancelled.

writable

4.6. or later

currentTarget

EventTarget

The node of the Document object that is currently handling the event.

read only

4.6. or later

eventPhase

unsigned short

The phase that the event is currently in. Valid values include:

  • 1: Indicates that the event is in the capturing phase.
  • 2: Indicates that the event is in being handled by the target node.
  • 3: Indicates that the event is in the bubbling phase.

read only

4.6. or later

target

EventTarget

The target node to which the event was dispatched.

read only

4.6. or later

timeStamp

unsigned long

The time (in milliseconds since epoch) at which the event was created.

read only

4.6 or later

type

String

The name of the event.

read only

4.6 or later

Event methods

Method name

Description

Availability

initEvent()

Initializes the properties of an Event object created by Document.createEvent().

4.6 or later

preventDefault()

Cancels the event, preventing the default action from occurring.

4.6 or later

stopPropagation()

Prevents further propagation of this event during an event flow.

4.6 or later

Method: Event.initEvent()

Availability

BlackBerry® Device Software version 4.6 or later

The initEvent() method initializes the properties of an Event object created by Document.createEvent(). This method must be called before the event has been dispatched using Node.dispatchEvent().

Syntax

Event.initEvent( eventTypeArg, canBubbleArg, cancelableArg )

Parameters

Parameter

Type

Description

eventTypeArge

String

Specifies the event type.

canBubbleArg

boolean

When true, this parameter indicates that the event will bubble.

cancelableArg

boolean

When true, this parameter indicates that Event.preventDefault() can cancel the event.

Return values

None.

Exceptions

None.

Method: Event.preventDefault()

Availability

BlackBerry® Device Software version 4.6 or later

The preventDefault() method cancels the event, preventing the default action from occurring.

Calling this method for an event whose cancelable property is set to false will have no effect.

Syntax

Event.preventDefault()

Parameters

None.

Return values

None.

Exceptions

None.

Method: Event.stopPropagation()

Availability

BlackBerry® Device Software version 4.6 or later

The stopPropagation() method prevents further propagation of this event during an event flow. If this method is called by any EventListener, the event will no longer propagate through the tree. The event will complete the dispatch to all listeners on the current EventTarget before the event flow stops.

This method can be used at any stage of the event flow.

Syntax

Event.stopPropagation()

Parameters

None.

Return values

None.

Exceptions

None.

Previous topic: Object: EntityReference

Was this information helpful? Send us your comments.