How do I handle priority and propagation in an event system?
- by Peeter
Lets say I have a simple event system with the following syntax:
object = new Object();
object.bind("my_trigger", function() { print "hello"; });
object.bind("my_trigger", function() { print "hello2"; });
object.trigger("my_trigger");
How could I make sure hello2 is printed out first (I do not want my code to depend on which order the events are binded).
Ontop of that, how would I prevent my events from propagating (e.g. I want to stop every other event from being executed)