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;
warning : this extension is not quite stable yet
many of the official components, at this time, require some boiler plate code, mainly small dependencies.
http://libs.ext-code.com/js/dom/component/component.js?init
adding the init search parameter automatically sets up the default boilerplate, which for most of the official
components is all that is required.
here is a simple example that includes the web-console
view the full list of components
html component list
view the
component.js
library documentation and api
component library
a component / module will has a standard lifecycle that is
components are also 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 of variables or tag names.
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
Here is a simple setup that loads the log-mod element. Its function is to log toaster style messages in a webpage.
the code for the log-mod component, note
var obj = {
version : 'v2.0'
};
return obj;
obj.initmod = function(){}
obj.init = function(){}
obj.initdom = function(){}
var registry = new ComponentRegistry();