Elements as modules
The server defines which element the module gets, and the module requires it by name: tutorial/Target.
return (new AsyncResponse())
->defineElement('tutorial/Target', 'box-a')
->call('tutorial/Highlight', 'pulse')
->send();
// JavaScript: the module is the element
export default class Highlight {
pulse() {
requireModule('tutorial/Target')
.classList.add('ring-4');
}
}