parcoursup/node_modules/riot/esm/api/register.js
lalBi94 7bc56c09b5 $
2023-03-05 13:23:23 +01:00

29 lines
774 B
JavaScript

/* Riot WIP, @license MIT */
import { COMPONENTS_IMPLEMENTATION_MAP, panic } from '@riotjs/util';
import { createComponentFromWrapper } from '../core/create-component-from-wrapper.js';
/**
* Register a custom tag by name
* @param {string} name - component name
* @param {Object} implementation - tag implementation
* @returns {Map} map containing all the components implementations
*/
function register(name, _ref) {
let {
css,
template,
exports
} = _ref;
if (COMPONENTS_IMPLEMENTATION_MAP.has(name)) panic(`The component "${name}" was already registered`);
COMPONENTS_IMPLEMENTATION_MAP.set(name, createComponentFromWrapper({
name,
css,
template,
exports
}));
return COMPONENTS_IMPLEMENTATION_MAP;
}
export { register };