document.write("
<hello-world data-text="&mvte:text;"></hello-world>
instance.mvt - Snippet hosted by \"Cacher\"
<mvt:item name="head" param="js:flex_helloworld" />
<template id="hello-world">
<mvt:item name="head" param="css:flex_helloworld" />
<span class="hello-world-text"></span>
</template>
init.mvt - Snippet hosted by \"Cacher\"
//helloworld.js utilizing Web Components
class HelloWorld extends HTMLElement {
constructor()
{
super();
this.attachShadow( { mode: 'open' } );
}
connectedCallback() {
const template = document.getElementById( 'hello-world' );
this.shadowRoot.appendChild( template.content.cloneNode( true ) );
this.shadowRoot.querySelector('.hello-world-text').textContent = this.getAttribute( 'data-text' );
}
}
customElements.define( 'hello-world', HelloWorld );
helloworld.js - Snippet hosted by \"Cacher\"
/* helloworld.css */
.hello-world-text
{
color: red;
font-size: 32px;
}
Flex_Examples - Snippet hosted by \"Cacher\"
");