Communication models
There are various communication models we can use to enable inter-component communication. The simplest would be method invocations, or function calls. This approach is the most direct and the easiest to implement. However, there's also a deep coupling between one component that directly invokes method of another. This can't scale beyond a couple components.
Instead, we need a level of indirection between our components; something that mediates the communication from one component to another. This helps us to scale our inter-component communication because we're no longer communicating directly with other components. Instead, we're relying on our communication mechanism to fulfill message delivery. The two prevalent models for such a communication mechanism are message passing and event triggering. Let's compare the two approaches.
Message-passing models
Message-passing communication models are commonplace in JavaScript applications. For example, messages can be passed...