So, in essence you want custom events. You can attach a custom event to 
anything that is extended with Events. The only thing is that you have to 
manually trigger them.

For example:

window.addEvent('awesomeSpace:go', function(){ console.log('triggered 
awesome'); });

window.fireEvent('awesomeSpace:go');


You can also pass arguments to the event you're firing:

var element = $('someId'); // lets assume an element with id="someId" 
exists in the DOM.

element.addEvent('ToDo:addItem', function(title){ console.log('Adding "' + 
title + '" to the list!'); });

element.fireEvent('ToDo:addItem', 'Conquer the world'); // console prints: 
Adding "Conquer the world" to the list!

Reply via email to