What is it
Eventspace.js is a library to manage events in spaces. You can have different spaces during life course of your web application and with Eventspace.js you can set different handler for same nodes in every space and manage those different phases.
What is a Space
A space is a phase of your web page (or web application), for example there could be a 'init' space in which you load your application, a 'pre' phase which precedes a particular event and then a 'post' phase.
How to use
To use Eventspace.js you just have to download and include eventspace.js Create your spaces of event:
ES.add('init');
ES.add('pre');
ES.add('post');
Or just:
ES.add(['init','pre','post']);
Set event for spaces:
ES.on({
node: document.body,
event: 'click',
space: ['init', 'pre']
}, function(){
alert('Clicked in space init or pre');
})
ES.on({
node: document.body,
event: 'click',
space: ['post']
}, function(){
alert('Clicked in space post');
})
Activate spaces:
ES.set('init');
And if you click on webpage body you will see an alert "Clicked in space init or pre"
Deactivate spaces:
ES.set();
And now if you click on webpage body you won't see any alert
Authors and Contributors
Paolo Cifariello (@PaoloCifariello)