to get web components working include the component library
after that any elements with a [component] attribute will be treated as a web component module
the component.js library exposes a mod object, which holds as its keys the component modules, the key is either the element nodename, or its id, the id can be used when the page contains multiple of the same component
var editor = mod['web-editor'];
var editor2 = mod.test;
view the full list of components
html component list
view the
component.js
library documentation and api
component library
to me a component / module will have a standard lifecycle that is
components should also be effectively namespaced so they are free to load any other components that they may need without having to worry that there will ever be a clash
the component library just needs to be included as a script tag, it exposes a global property mod, it runs on window.onload, it has a fundatmental loading stack that allows init runs to be delayed until the loading stack is complete
i demonstrate here a simple setup that loads a log-mod element whos function is to log toaster style messages in a webpage
the common elements to this setup are the inclusion of the component script, the initialisation ( init ) function and the initdom
this is the code for the log-mod component