radi
Version:
**Radi** is a tiny javascript framework.
14 lines (11 loc) • 390 B
JavaScript
import Component from './Component';
import GLOBALS from '../consts/GLOBALS';
const headless = (key, Comp) => {
// TODO: Validate component and key
const name = '$'.concat(key);
const mountedComponent = new Comp();
mountedComponent.mount();
Component.prototype[name] = mountedComponent;
return GLOBALS.HEADLESS_COMPONENTS[name] = mountedComponent;
};
export default headless;