events
events.dispatch(type, context)
Triggers one of our custom events
Kind: static method of events
Param | Type | Description |
---|---|---|
type | String |
Type of event to dispatch |
context | Node |
Element to trigger the event from |
Example
if (updatedMarkup) {
dispatch("pageModified", modalElement);
}
events.getName(type) ⇒ String
Namespaced event
Kind: static method of events
Param | Type | Description |
---|---|---|
type | String |
Type of event to get the actual event name for |
events~events
Event object - called on dispatch
Kind: inner constant of events
events.pageModified()
Event is dispatched when DOM in the page has changed, triggers updates from all modules listening for the change (init instances, etc)
- Is triggered by modules that were responsible for modifying the page
Kind: static method of events
events.pageResized()
Event called when page is resized
Kind: static method of events
events.beforePrint()
Event dispatched before page print begins (teardown/restructure/hide things)
Kind: static method of events
events.afterPrint()
Event dispatched after page print (cleanup)
Kind: static method of events
events~initResize()
Setup resize handler/dispatch
Kind: inner method of events
events~initPrint()
Setup print listeners
- Note: Tested with matchMedia but these events are more consistent Experimented with normalizing both events but they fired strangely, using any delay won't work (ie setTimeout / RAF) chrome pauses immediately javascript after the initial event. Reverting to a straightforward method for now. If this ends up needing something more robust we can work that out on this side and it won't change how the custom events file.
Kind: inner method of events