Class Index | File Index

Classes


Class dijon.EventMap

dijon.EventMap
Defined in: dijon.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
registers class members as listeners for specific events, before (or after) instantiation.
Method Summary
Method Attributes Method Name and Description
 
addClassMapping(eventType, clazz, handler, oneShot, passEvent)
maps handler as a listener for eventType to be called as a member of a clazz instance.
 
addRuledMapping(eventType, key, handler, oneShot, passEvent)
maps handler as a listener for eventType to be called as an instance member of the class mapped to key instance.
 
hasMapping(eventType, key, handler)
Checks whether a mapping exists.
 
removeClassMapping(eventType, clazz, handler)
Removes the mapping for clazz
 
removeRuledMapping(eventType, key, handler)
Removes the mapping for key
Class Detail
dijon.EventMap()
registers class members as listeners for specific events, before (or after) instantiation.
Allows for mapping listeners to lazily instantiated objects.
[!] This class differs substantially from the RobotLegs EventMap both in use and functionality
Method Detail
addClassMapping(eventType, clazz, handler, oneShot, passEvent)
maps handler as a listener for eventType to be called as a member of a clazz instance. The instance will ALWAYS be a new one, regardless of previous injector mappings for that clazz.
If handler is undefined or null the instance will be created but no handler will be invoked.
In that case the dispatched payload will not be passed. (no constructor injection at the moment)
Parameters:
{String} eventType
{Class} clazz
{Function} handler Optional, Default: null
{Boolean} oneShot Optional, Default: false
{Boolean} passEvent Optional, Default: false

addRuledMapping(eventType, key, handler, oneShot, passEvent)
maps handler as a listener for eventType to be called as an instance member of the class mapped to key instance. The instance will be created according to the rule defined for key in injector.
[!] requires key is already ruled by the injector
Parameters:
{String} eventType
The name of the event to be listened to
{Object} key
{Function} handler
{Boolean} oneShot Optional, Default: false
Whether the listener must be called only once
{Boolean} passEvent Optional, Default: false
Whether the event object should be passed as a parameter to handler upon invocation or not. If true any additional dispatched values will be passed as parameters after the event object
See:
dijon.Injector

{Boolean} hasMapping(eventType, key, handler)
Checks whether a mapping exists. The combination of eventType, key, handler must be identical to what was mapped for this to return true. If key was mapped for eventType with a handler then hasMapping will return false if only invoked with parameters eventType and key
Parameters:
{String} eventType
{Object} key
{Function} handler Optional, Default: null
Returns:
{Boolean}

removeClassMapping(eventType, clazz, handler)
Removes the mapping for clazz
Parameters:
{String} eventType
{Class} clazz
{Function} handler Optional, Default: null
See:
dijon.EventMap#addClassMapping

removeRuledMapping(eventType, key, handler)
Removes the mapping for key
Parameters:
{String} eventType
The name of the event to be listened to
{Class} key
{Function} handler
See:
dijon.EventMap#addRuledMapping

Documentation generated by JsDoc Toolkit 2.3.2 on Wed Oct 19 2011 10:16:19 GMT+0200 (CEST)