How can i subscribe events from some DOM nodes if I do not want to produce changes in DOM? How can I achive something like this in cyclejs or motorcyclejs?
function main({DOM}) {
DOM.select('button').events('click').forEach(e => console.log(e))
return {}
}
run(main, {DOM: makeDOMDriver('#app')})
updated: DOM tree already exits before running main function:
<div id="app">
<button>Click</button>
</div>
The example above does not work, the event listener is not attached to DOM node.