Dojo's GlobalEvent
enables events to be registered on document
and window
reactively.
- Can be used as a wrapping widget and will return children on render or used within a widgets returned DNode structure and returns
null
fromrender
. - Reactively adds and removes global events listeners based on the
window
anddocument
properties.
// Wrapping DNodes as children
w(GlobalEvent, {
window: { keydown: () => {} },
document: { focus: () => {} }
}, [
// Add widget's DNodes
]);
// Used in the DNode tree
v('div', { key: 'root' }, [
w(GlobalEvent, { window: { click: () => {} } }),
w(Button, { /* button options */ })
]);