Chapter 14. Events and application data flow
This chapter covers
- Creating your own Custom Events versus using the DOM’s native events
- Event bubbling for the two event types, including using the composed option to bubble through the Shadow DOM
- The WebComponentsReady event and the customElements.isDefined promise for handling timing
- Using a centralized data model and an event bus to handle data flow throughout an application
As we get closer to the end of our Web Component journey together, there really isn’t much left to cover in terms of Web Component features. That said, when contrasting what we’ve learned thus far in this book against a modern framework, Web Components may feel a little lacking in some areas.
While Web Component features are now part of standard web specifications, things like data binding, routing, and model-view-controller (MVC) style application design patterns are not! To be honest, it would be kind of silly if they were. The web is a big place, and we’re not all doing applications. Even if we were, application developers will typically pick the right design pattern for a specific project. Native features that favor certain ways of doing application development would likely not be a welcome addition.