In every well-behaving event-driven architecture, there must be some rules that specify some partial ordering (timeline) for the events that will occur in response to some operations.
If these orderings are violated, even by just a little bit, the event-driven world falls apart. This gives rises to non-deterministic or hilariously triggerable bugs such as "application crashes when I mouse over the menu bar when the application is doing (something)".
Events come from a source, and are dispatched to one or more listeners.
There is no requirement that the framework must perform this dispatching in a strictly deterministic and imperative manner. In other words, although the following is a very popular mental model among programmers, the framework is not necessarily implemented in that way.
- New event - push a new message into a queue.
- Framework - for every message that has one or more listeners, distribute (replicate) it to its listeners.
- Each listener waits for a new message from the queue.
- Each listener takes and processes the new message.
Notice that event types might be defined based on either the source (e.g.
Work can have events
WorkFinished), or on actions (affordances) it can perform (e.g.
ProgressIcon can receive
In some frameworks, the source-defined events and action events are separate types and given separate terminologies (such that the latter are not called "events" at all.) In some other frameworks they are both called events, because of the framework's choice to implement events using a unifying concept called delegates, which has a programmer's mental model that is very similar to callback functions.
You should be able to see where your confusion comes from: because the framework you're using makes everything looks like function calls, you have the temporary illusion that everything you can do with function calls, you can also do with delegates, and by extension also do anything with events. However, this is not the original intention of event-driven architecture.
In addition, programmers that use different frameworks will never face this confusion, and will have a hard time understand why this question arises.