/
Add priority to event hooks

Add priority to event hooks

In-Portal uses event-based model, where something starts to happen only when event is triggered and there are listeners for that event that do actual work.

Hooks is a way for any event to eavesdrop on any other event in the system. Right now, when several hooks for same event are registered, then they are invoked in same order they were registered. This poses a problem in cases, when hooks want to communicate and are unsure if that other hook will always be executed before them or not.

Solution

Add Priority setting for hooks, which will be 0 by default. Then we sort all registered hooks according to their priority and only then execute.

Related Tasks