Chapter 5. Instrumenting a better web app through modules
This chapter covers
- ES2015 modules as an alternative to <script> tags in your HTML
- Creating self-reliant Web Components
- Using a Web Component to contain your entire application
- Scope management for callbacks with the ES2015 fat-arrow feature
So far in exercises throughout this book, we’ve been putting our classes and component definitions inside the <head> tag in our main HTML page. Typically, you’d never want to do this on a real project and might want to be a bit more organized with a <script> tag pointing to a JS file for each component you have. At first glance, this is perfectly fine. If your project uses Web Components only in a limited way, this works! CSS is similar—each component ...
Get Web Components in Action now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.