A template for OpenMusic Web Components
Grab index.js
from the repo or do npm install openmusic-web-component-template
.
Include index.js
before you use the component:
<script src="index.js"></script>
It will be registered automatically as openmusic-web-component-template
, so you can document.createElement('openmusic-web-component-template')
or just have <openmusic-web-component-template>
elements in your HTML source.
You need to load the module and then register it--it is not automatically registered!
require('openmusic-web-component-template').register('openmusic-web-component-template');
But you could even register it with other name, for example:
require('openmusic-web-component-template').register('mega-web-component-template');
Up to you.
Have a look at demo/demo.js
for an example that does things in order to things.
Explanation of attribute.
Examples:
<openmusic-web-component-template attribute="-1"></openmusic-web-component-template>
This event will be dispatched when x happens. To listen for event
events on this component, add an event listener:
component.addEventListener('event', function(ev) {
var detail = ev.detail;
// detail contains the values you want
});