Skip to content

registerComponents

ts
registerComponents(...classes: BaseConstructor[]): void

registerComponent() for several classes, in order.

Usage

js
import { 
Base
,
registerComponents
} from '@studiometa/js-toolkit';
class
Accordion
extends
Base
{
static
config
= {
name
: 'Accordion' };
} class
Slider
extends
Base
{
static
config
= {
name
: 'Slider' };
} class
TodoList
extends
Base
{
static
config
= {
name
: 'TodoList' };
}
registerComponents
(
Accordion
,
Slider
,
TodoList
);

This is the whole bootstrap of a page. There is no createApp() and no root component: each of these registers its own declared family, and every registered name auto-mounts through the single MutationObserver.

Parameters

  • ...classes — classes extending Base.

Return value

  • void.

Order matters only for collisions: the first registration of a name wins and the second gives a registry.conflict warning.

MIT Licensed