events
events.dispatch(type, context)
Triggers one of our custom events (page/document level events)
- UI components may dispatch their own events, this is just used for system wide 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
- Should be used for all ulu script/component events
Kind: static method of events
Param | Type | Description |
---|---|---|
type | String |
Type of event to get the actual event name for |
events.createEvent(type, data, options)
Create ulu namespaced custom event
Kind: static method of events
Param | Type | Description |
---|---|---|
type | String |
Event base name (not prefixed) |
data | any |
Custom data to pass with the event (will be available as event.detail ) |
options | Object |
CustomEvent options default { bubbles: true } . If detail is also provided, it will be merged with this options object and will override the 'data' argument for this function |
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