Set Event Handler - PaoloCifariello/Eventspace.js GitHub Wiki

You can add event handlers by passing an HTML node, an event, a space (array of spaces) and the function that you want to be triggered.

For example if you want different behaviour when document.body is clicked in init or pre phase respect to when it's clicked in post phase you can type:

ES.on({
    node: document.body,
    event: 'click',
    space: ['init', 'pre']
}, function(){
    alert('Clicked in space init or pre');
})

and for post space:

ES.on({
    node: document.body,
    event: 'click',
    space: ['post']
}, function(){
    alert('Clicked in space post');
})