Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
type Init =
(modules: Array) => ((vnode: VNode) => string);
interface ModulesForHTML {
attributes: Module;
props: Module;
class: Module;
style: Module;
}
export type Module =
(vnode: VNode, attributes: Map) => void;
const defaultModules = [
modulesForHTML.attributes,
modulesForHTML.props,
modulesForHTML.class,
modulesForHTML.style,
];
export interface HTMLDriverOptions {
modules?: Array;
}
export type EffectCallback = (html: string) => void;
const noop = () => {};
export function makeHTMLDriver(effect: EffectCallback,
options?: HTMLDriverOptions): Driver, HTMLSource> {
if (!options) { options = {}; }
const modules = options.modules || defaultModules;
const toHTML = init(modules);
const modulesForHTML: ModulesForHTML = require('snabbdom-to-html/modules');
type Init = (modules: Array) => ((vnode: VNode) => string);
interface ModulesForHTML {
attributes: Module;
props: Module;
class: Module;
style: Module;
}
export type Module = (vnode: VNode, attributes: Map) => void;
const defaultModules = [
modulesForHTML.attributes,
modulesForHTML.props,
modulesForHTML.class,
modulesForHTML.style,
];
export interface HTMLDriverOptions {
modules?: Array;
}
export type EffectCallback = (html: string) => void;
function reportSnabbdomError(err: any): void {
console.error(err);
}
export function makeHTMLDriver(
effect: EffectCallback,