vite-riot-template/src/js/register.js

24 lines
481 B
JavaScript
Raw Normal View History

import {register, mount} from 'riot';
/**
* Register Global Components
2022-09-09 03:02:22 +00:00
*
* helper that registers and mounts global components
* via an object registry
2022-09-09 03:02:22 +00:00
*
* @param {Object} registry key:value object registry
*/
export function Register(registry = {}) {
Object.entries(registry).map(([name, component]) => {
register(name, component);
mount(name);
return {
name,
component
}
});
}
export default Register;