2022-07-29 04:15:07 +00:00
|
|
|
import {register, mount} from 'riot';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register Global Components
|
2022-09-09 03:02:22 +00:00
|
|
|
*
|
2022-07-29 04:15:07 +00:00
|
|
|
* helper that registers and mounts global components
|
|
|
|
* via an object registry
|
2022-09-09 03:02:22 +00:00
|
|
|
*
|
2022-07-29 04:15:07 +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;
|