How to use the snabbdom-to-html/modules.attributes function in snabbdom-to-html

To help you get started, we’ve selected a few snabbdom-to-html examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cyclejs / cyclejs / html / src / makeHTMLDriver.ts View on Github external
const init: Init = require('snabbdom-to-html/init');
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(
github hex13 / enter-ghost / packages / san-escobar / printObject.js View on Github external
//props: Object.getOwnPropertyNames(o).concat('__proto__').map(k => {
            //props: Object.keys(o).concat('__proto__').map(k => {
                return {
                    name: k,
                    value: createTreeFromObject(o[k], visited)
                }
            })
    }
}


const h = require('snabbdom/h').default;
const modules = require('snabbdom-to-html/modules')

const toHtml = require('snabbdom-to-html/init')([
    modules.attributes,
]);

let idCounter = 0;
function createId() {
    return 'el_' + (++idCounter);
};

const escapeHtml = s => s.replace(/
github cyclejs / cyclejs / dom / src / makeHTMLDriver.ts View on Github external
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;

snabbdom-to-html

Render Snabbdom Vnodes to HTML strings

MIT
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis