piral-mithril
Version:
Plugin for integrating Mithril.js components in Piral.
21 lines (19 loc) • 389 B
text/typescript
import { m } from 'mithril';
export function createExtension(rootName: string) {
return {
oncreate(vnode) {
vnode.dom.dispatchEvent(
new CustomEvent('render-html', {
bubbles: true,
detail: {
target: vnode.dom,
props: vnode.attrs,
},
}),
);
},
view() {
return m(rootName);
},
};
}