Hi, Flight people.
I have one question regarding to order of executing callbacks for some events.
I have two components -- first is A, and second is B. Both of them have this line in after initialize function:
//A.js
this.on("uiFoo", this.callback1);
//B.js
this.on("uiFoo", this.callback2);
When "uiFoo" is triggered, first A's callback is executed and then B's. The reason is that A's after initialize callback is called at the first place and after that B's. There are many more situation, but for sake of simplicity I'm giving this one. I want that B is executed first.
One work-around is:
//A.js
this.on("uiBar", this.callback1);
//B.js
this.on("uiFoo", this.callback2);
this.after("callback2", function (e) {
if (e.type === "uiFoo") {
this.trigger("uiBar");
}
});
It seems clean (maybe), but there is a lot of boilerplate.
Is it possible somehow to control this order of execution or some better way to do this?
Regards,
Pera