Information

Overview

Custom Web Component is a wrapper class, extending native classes and giving you sugar to help you web components from full applications through to re-usable parts. There is also the lit-html templating library should you wish to use databinding in your component templates. This area will explain these parts in more detail, as well as methods and properties you may not be aware of.

Web components break down into three main areas. That of the polyfills; the methods and classes we add to alder browsers, backporting the missing standards. Next we have the data binding engine, giving us the abiliyt to write concise templates and bind them direct ot the logic with minimal code. This allow us to create complex dynamic interfaces. Finally we pull this all together, building on teh native and polyfilled standards with Custom Web Component; allowing us to create extended HTML components.

Want to Help?

Documentation takes a long time to create, why not help us help you! If you see issues with this documentation get in touch. Find us all over the web.

Custom Web Component

This is the wrapper library, a simple class with extra helpers, bringing the lit-html templating tool and some extra methods together into an extendable class. We try to mimic other standards too, so where we have a method and require a similar method, we try to implement these in the same fashion.

By extending the DOM lifecycle, we also get the benefit of being able to use these points in time to set up components, do background tasks. Once the web component has been registered to the DOM, we are free to use it in parent web components or direct in HTML pages, be them static HTML files or complex applications.

lit-html

Whilst we try not to have any dependencies, apart form polyfills, we do however import teh lit-html databinding library; this gives us many benefits. Weare able to write much simpler tmeplates and write far less logic to work them (the HTML API). Being a good programmer, you should always strive to be lazy, write once use everywhere.

The lit-html lirbary brings a very powerfull feature set, with javascript standard templating markup, allowing is to embed logic inside our templates. You do not have to use this, you can simply interface with your templates with goo old DOM manipulation, but lit-html takes the pain out of this and its very lightweight.

Polyfills

These solve one purpose, to fill in missing functionality as close to standards as possible. So when the browsers adopt the standard, the polyfill simply stops loading, allowing the native methods and classes to take over.

Simply put, your code improves with age, which is the reverse to the normal lifespan of code, which fragments with ages. Custom Web Components get faster as they age, not slower. Proxy, Object.assign(), Promise and reflect constructor are all examples of functionality we have to back port, mainly due to IE support.