UNPKG

piral-hyperapp

Version:

Plugin for integrating hyperapp components in Piral.

21 lines (19 loc) 560 B
import type { ExtensionSlotProps } from 'piral-core'; import { createHyperappElement } from './mount'; import type { Component } from './types'; export function createExtension(rootName: string): Component<ExtensionSlotProps> { return (props) => createHyperappElement(rootName, { oncreate(element: HTMLElement) { element.dispatchEvent( new CustomEvent('render-html', { bubbles: true, detail: { target: element, props, }, }), ); }, }); }