Question

Let's 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 were bind).

On top of that, how would I prevent my events from propagating? (e.g. I want to stop every other event from being executed)

No correct solution

Licensed under: CC-BY-SA with attribution
scroll top