EventHub.AddEventListener

Warn

  • callbacks should be pre-defined functions, not inline closures so they can be removed from subscription queue if required

Will subscribe a callback for a given event type

Example

var eventHub = new EventHub(); var callback = function(nameArgs){ alert(nameArgs.name); } eventHub.AddEventListener("name-changed", callback);

(Void) AddEventListener(eventType(String) The event type to subscribe to , callback(Function) The callback to invoke when the event type is raised, will be passed any arguments )

Param

  • eventType

    (String)

    The event type to subscribe to

  • callback

    (Function)

    The callback to invoke when the event type is raised, will be passed any arguments