Inherits from NSObject
Conforms to NSCopying
PXPooledObject
Declared in PXEvent.h
PXEvent.m

Overview

The base class for all events dispatched through the PXEventDispatcher class.

A PXEvent holds all of the information related to the given event, and is always passed in as the first argument of every event listener invocation by an event listener.

While the PXEvent class is the base for all other event classes, it’s not abstract, meaning that it can be used on its own for several common events.

Tasks

  •   bubbles

    Describes whether the event participates in the bubbling phase of the event flow.

    property
  •   cancelable

    Describes whether the behavior represented by the event may be canceled. If YES, preventDefault may be used.

    property
  •   currentTarget

    The node in the event flow currently processing the event.

    property
  •   target

    The node representing the ultimate target of the event.

    property
  •   type

    A string representing the type of the event

    property
  •   eventPhase

    The event in which the event is currently participating

    property
  • – initWithType:

    Makes a new event with the given properties. These properties may not change after the event object is created.

  • – initWithType:bubbles:cancelable:

    Makes a new event with the given properties. These properties may not change after the event object is created.

  • – preventDefault

    Causes the behavior represented by this event to be canceled. Not all events may be canceled. Use the cancelable property to check if this event’s behavior can be canceled.

  • – stopPropagation

    Prevents the event from being dispatched any further in the event flow.

  • – stopImmediatePropagation

    Stops the event from being dispatched any further, and cancels event dispatching for all remaining event listeners registered to listen for this event.

  • – isDefaultPrevented

    Whether the preventDefault method has been called on this event.

  • – eventWithType:

    Makes a event with the given properties. These properties may not change after the event object is created.

  • – eventWithType:bubbles:cancelable:

    Makes a event with the given properties. These properties may not change after the event object is created.

Properties

bubbles

Describes whether the event participates in the bubbling phase of the event flow.

@property (nonatomic, readonly) BOOL bubbles

Declared In

PXEvent.h

cancelable

Describes whether the behavior represented by the event may be canceled. If YES, preventDefault may be used.

@property (nonatomic, readonly) BOOL cancelable

Declared In

PXEvent.h

currentTarget

The node in the event flow currently processing the event.

@property (nonatomic, readonly) id currentTarget

Declared In

PXEvent.h

eventPhase

The event in which the event is currently participating

@property (nonatomic, readonly) PXEventPhase eventPhase

Declared In

PXEvent.h

target

The node representing the ultimate target of the event.

@property (nonatomic, readonly) id target

Declared In

PXEvent.h

type

A string representing the type of the event

@property (nonatomic, readonly) NSString *type

Declared In

PXEvent.h

Instance Methods

eventWithType:

Makes a event with the given properties. These properties may not change after the event object is created.

- (PXEvent *)eventWithType:(NSString *)type

Parameters

type

A string representing the type of the event

Discussion

Uses default values bubbling = NO and cancelable = NO.

Declared In

PXEvent.m

eventWithType:bubbles:cancelable:

Makes a event with the given properties. These properties may not change after the event object is created.

- (PXEvent *)eventWithType:(NSString *)type bubbles:(BOOL)bubbles cancelable:(BOOL)cancelable

Parameters

type

A string representing the type of the event

bubbles

Whether the event should participate in the bubbling phase of the event flow.

cancelable

Whether the behavior described by the event can be canceled by the user.

Declared In

PXEvent.m

initWithType:

Makes a new event with the given properties. These properties may not change after the event object is created.

- (id)initWithType:(NSString *)type

Parameters

type

A string representing the type of the event

Discussion

Uses default values bubbling = NO and cancelable = NO.

Declared In

PXEvent.m

initWithType:bubbles:cancelable:

Makes a new event with the given properties. These properties may not change after the event object is created.

- (id)initWithType:(NSString *)type bubbles:(BOOL)bubbles cancelable:(BOOL)cancelable

Parameters

type

A string representing the type of the event

bubbles

Whether the event should participate in the bubbling phase of the event flow.

cancelable

Whether the behavior described by the event can be canceled by the user.

Declared In

PXEvent.m

isDefaultPrevented

Whether the preventDefault method has been called on this event.

- (BOOL)isDefaultPrevented

Declared In

PXEvent.m

preventDefault

Causes the behavior represented by this event to be canceled. Not all events may be canceled. Use the cancelable property to check if this event’s behavior can be canceled.

- (void)preventDefault

Declared In

PXEvent.m

stopImmediatePropagation

Stops the event from being dispatched any further, and cancels event dispatching for all remaining event listeners registered to listen for this event.

- (void)stopImmediatePropagation

Declared In

PXEvent.m

stopPropagation

Prevents the event from being dispatched any further in the event flow.

- (void)stopPropagation

Declared In

PXEvent.m