piral-mithril
Version:
Plugin for integrating Mithril.js components in Piral.
25 lines (24 loc) • 850 B
TypeScript
import { createConverter } from './lib/converter';
export interface HtmlComponent<TProps> {
component: {
mount(element: HTMLElement, props: TProps, ctx: any, locals: any): void;
update?(element: HTMLElement, props: TProps, ctx: any, locals: any): void;
unmount?(element: HTMLElement, locals: any): void;
};
type: 'html';
}
export interface MithrilConverter {
(...params: Parameters<ReturnType<typeof createConverter>>): HtmlComponent<any>;
}
export declare function createMithrilConverter(...params: Parameters<typeof createConverter>): {
from: MithrilConverter;
Extension: {
oncreate(vnode: any): void;
view(): any;
};
};
declare const fromMithril: MithrilConverter, MithrilExtension: {
oncreate(vnode: any): void;
view(): any;
};
export { fromMithril, MithrilExtension };