7. USAGE
TRE.dEetitnr 'lc' f,fle)
AGTadvnLsee( cik, n as ;
TRE.eoevnLsee('lc' f,fle)
AGTrmvEetitnr cik, n as ;
Third parameter ' s C p u e is now optional
ueatr'
including it is safer
10. CAPTURE PHASE
Starts at the outer most and ends at the inner most element
Can generally be ignored
TARGET PHASE
Event is dispatched to the target element
BUBBLING PHASE
Starts at the inner most and ends at the outer most element
Extremely useful
11. WHY IS THIS EVENT BUBBLING USEFUL?
'click' event on children
+ new
'click' event on parent
+ event bubbling
Clicked:
Clicked:
1
2
3
1
2
3
12. HOW EXACTLY DOES IT WORK?
Events are fired from the inner most element
E.g. Children of the element with the event listener
25. ADDING A MEDIATOR TO YOUR APP
Central location to handle communication
Modules don't need to know anything about other modules
Modules can focus on the single responsibility principle
31. BENEFITS
Loosely coupled architecture
Smaller units of code
Easy to extend functionality
CONS
assume that subscribers exist
not easy to resolve a failed publisher
increased number of messages can lead to instabilities