Executes all event listeners added with on() method.
eventData object, parameters of the event
Returns object.


Internally, all w2ui widgets call trigger to execute event listeners. You can add your own events and trigger them with the trigger function. The trigger function has a specific life cycle, your first trigger the event and then you signal when event is completed. You trigger the event before the default behavior is processed and the signal completionafter it it processed. This is needed to comply with the event flow.
Here is an example how widgets trigger events: As you see from the example above, the default action can be cancelled by event handler calling event.preventDefault(). There is no need to return event object because JavaScript passes objects by reference and changing the event within the handler will change the original object.
You can optionally call event.done(callBack) to prive a funciton which will be executed at the end of event life cycle (after default behaviour is complete).

User Comments

comments powered by Disqus