new WKcSignaler() → {Object}
The class
WKcSignaler can be used to signal events
(observer pattern). The class methods are usually inherited by
or mixed into other classes.
- Source:
Returns:
A new
WKcSignaler object.
- Type
- Object
Methods
-
addObserver(p_type, p_observer) → {WKcSignaler}
-
Adds an observer for events of type
p_type.Parameters:
Name Type Description p_typeString | int The type of the event signaled. Usually a property value of the object $wk$.$E$. The pseudo type"*"denotes that all events are signaled to the observer.p_observerfunction A callback function. The parameter list of that function depends on the signaler that dispatches events of type p_type- Source:
Returns:
this- Type
- WKcSignaler
-
addObservers(p_observers) → {WKcSignaler}
-
Simultaniously adds observers for several events.
Parameters:
Name Type Description p_observersObject A hash map. Each key denotes an event type. The values must contain the observer functions to be called. - Source:
Returns:
this- Type
- WKcSignaler
-
removeObserver(p_type, p_observer) → {WKcSignaler}
-
Removes an observer for events of type
p_type.Parameters:
Name Type Description p_typeString | int The type of the event signaled. Usually a property value of the object $wk$.$E$. The pseudo type"*"denotes that all events are signaled to the observer.p_observerObject A callback function. The parameter list of that function depends on the signaler that dispatches events of type p_type- Source:
Returns:
this- Type
- WKcSignaler
-
removeObservers(p_observers) → {WKcSignaler}
-
Simultaniously removes observers for several events.
Parameters:
Name Type Description p_observersObject A hash map. Each key denotes an event type. The values must contain the observer functions to be called. - Source:
Returns:
this- Type
- WKcSignaler
-
signal(p_event, arguments) → {WKcSignaler}
-
Signals to all current observers that an event has occured. Signals an event of type
p_eventorp_event.typeto all observers that are currently listening on events of this type. As signaler object that dispatches this event acts eitherp_event.signaler(if that property exists) orthis.Parameters:
Name Type Description p_eventString | int | Object The event to be signaled. Usually a property value of the object $wk$.$E$, which denotes an event type. Ifp_eventis an object,p_event.typeis used as the type of the event to be signaled.argumentsArray Arbitrary further arguments that are passed to the observer functions (together with p_event).- Source:
Returns:
this- Type
- WKcSignaler