A minimal example component for the ccmjs framework.
This component renders a simple greeting using a configurable name.
Include ccmjs and start the component:
<!DOCTYPE html>
<meta charset="UTF-8">
<body>
<script src="./libs/framework/ccm-28.0.0.min.js"></script>
<script>
ccm.start("./ccm.hello.mjs", {
name: "Mika"
}, document.body);
</script>Hello Mika
Configuration is defined directly in the component source code.
Open ccm.hello.mjs to see all available configuration options and their descriptions.
This follows the ccmjs principle of code transparency: all configuration is documented where it is defined.
A ccmjs component exports a component object:
export const component = {
name: "hello",
ccm: "././libs/framework/ccm-28.0.0.min.js",
config: {
name: "World"
},
Instance: function () {
this.start = async () => {
this.element.textContent = "Hello " + this.name;
};
}
};Each ccmjs component is a standalone file that can be inspected at runtime.
No build step is required to develop or use ccmjs components. An optional release workflow provides minification, source maps, and integrity hashes.
You can always:
- read the original source code
- understand how the component works
- inspect it directly in the browser (via source maps)
- ccmjs Framework: https://github.com/ccmjs/framework
- Documentation: https://github.com/ccmjs/framework/wiki
<script
src="https://cdn.jsdelivr.net/gh/ccmjs/hello@v1.0.3/libs/framework/ccm-28.0.0.min.js"
integrity="sha384-HDMeDDgKlR2OFJ3ECMwmA6wknqpfpeCiSZYlUhQaFg9FKrvHJp8MMSwrxibvWJ2G"
crossorigin="anonymous"
></script>
<script type="module">
ccm.start(
"https://cdn.jsdelivr.net/gh/ccmjs/hello@v1.0.3/ccm.hello-1.0.3.min.mjs#sha384-3dtmKvcukK9126rQXFXN30Fv7nB63v8gghrzE0Ub7pTv6WhvVcqZqwqc0VuGmhmr",
{ name: "Mika" },
document.body
);
</script>MIT License