SPEvent Class Reference
Inherits from | NSObject |
Declared in | SPEvent.h |
Overview
The SPEvent class contains data that describes an event.
SPEventDispatcher
s create instances of this class and send them to registered listeners. An event
contains information that characterizes an event, most importantly the event type and if the event
bubbles. The target of an event is the object that dispatched it.
For some event types, this information is sufficient; other events may need additional information to be carried to the listener. In that case, you can subclass SPEvent and add properties with all the information you require. The SPEnterFrameEvent is an example for this practice; it adds a property about the time that has passed since the last frame.
Furthermore, the event class contains methods that can stop the event from being processed by other listeners - either completely or at the next bubble stage.
Tasks
Initialization
-
– initWithType:bubbles:
Initializes an event object that can be passed to listeners. Designated Initializer.
-
– initWithType:
Initializes a non-bubbling event.
-
+ eventWithType:bubbles:
Factory method.
-
+ eventWithType:
Factory method.
Methods
-
– stopImmediatePropagation
Prevents any other listeners from receiving the event.
-
– stopPropagation
Prevents listeners at the next bubble stage from receiving the event.
Properties
-
type
A string that identifies the event.
property -
bubbles
Indicates if event will bubble.
property -
target
The object that dispatched the event.
property -
currentTarget
The object the event is currently bubbling at.
property
Properties
bubbles
Indicates if event will bubble.
@property (nonatomic, readonly) BOOL bubbles
Discussion
Indicates if event will bubble.
Declared In
SPEvent.h
currentTarget
The object the event is currently bubbling at.
@property (weak, nonatomic, readonly) SPEventDispatcher *currentTarget
Discussion
The object the event is currently bubbling at.
Declared In
SPEvent.h
Class Methods
Instance Methods
initWithType:
Initializes a non-bubbling event.
- (instancetype)initWithType:(NSString *)type
Discussion
Initializes a non-bubbling event.
Declared In
SPEvent.h
initWithType:bubbles:
Initializes an event object that can be passed to listeners. Designated Initializer.
- (instancetype)initWithType:(NSString *)type bubbles:(BOOL)bubbles
Discussion
Initializes an event object that can be passed to listeners. Designated Initializer.
Declared In
SPEvent.h