How to use the snabbdom.h function in snabbdom

To help you get started, we’ve selected a few snabbdom 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 wireapp / wire-webapp / src / script / util / DebugUtil.js View on Github external
toggleLiveCallingStats() {
    const containerId = 'live-calling-stats';
    const containerElement = document.getElementById(containerId);
    if (containerElement) {
      clearInterval(this.liveCallingStatsInterval);
      document.body.removeChild(containerElement);
      return;
    }
    const statsDomElement = Object.assign(document.createElement('div'), {id: containerId});
    document.body.appendChild(statsDomElement);
    const patch = snabbdomInit([style]);
    let vdom = createElement('div');
    patch(statsDomElement, vdom);

    const renderStats = async participantsStats => {
      return Promise.all(
        participantsStats.map(async participantStats => {
          const rawStats = [];
          participantStats.stats.forEach(stats => {
            if (
              (stats.kind === 'audio' || stats.kind === 'video') &&
              (stats.packetsReceived || stats.packetsSent) &&
              !stats.id.includes('rtcp')
            ) {
              rawStats.push(stats);
            }
          });
github ornicar / chessground / examples / src / main.ts View on Github external
function render() {
    return h('div#chessground-examples', [
      h('menu', examples.map((ex, id) => {
        return h('a', {
          class: {
            active: example.name === ex.name
          },
          on: { click: () => page(`/${id}`) }
        }, ex.name);
      })),
      h('section', [
        h('div.chessground.wood.small.merida.coordinates', {
          hook: {
            insert: runExample,
            postpatch: runExample
          }
        }),
        h('p', example.name)
github ornicar / chessground / examples / src / main.ts View on Github external
h('menu', examples.map((ex, id) => {
        return h('a', {
          class: {
            active: example.name === ex.name
          },
          on: { click: () => page(`/${id}`) }
        }, ex.name);
      })),
      h('section', [
        h('div.chessground.wood.small.merida.coordinates', {
          hook: {
            insert: runExample,
            postpatch: runExample
          }
        }),
        h('p', example.name)
      ]),
      h('control', [
        h('button', { on: { click() { cg.toggleOrientation(); }}}, 'Toggle orientation')
      ])
    ]);
  }
github ornicar / chessground / examples / src / main.ts View on Github external
function render() {
    return h('div#chessground-examples', [
      h('menu', examples.map((ex, id) => {
        return h('a', {
          class: {
            active: example.name === ex.name
          },
          on: { click: () => page(`/${id}`) }
        }, ex.name);
      })),
      h('section', [
        h('div.chessground.wood.small.merida.coordinates', {
          hook: {
            insert: runExample,
            postpatch: runExample
          }
        }),
        h('p', example.name)
      ]),
github ornicar / chessground / examples / src / main.ts View on Github external
active: example.name === ex.name
          },
          on: { click: () => page(`/${id}`) }
        }, ex.name);
      })),
      h('section', [
        h('div.chessground.wood.small.merida.coordinates', {
          hook: {
            insert: runExample,
            postpatch: runExample
          }
        }),
        h('p', example.name)
      ]),
      h('control', [
        h('button', { on: { click() { cg.toggleOrientation(); }}}, 'Toggle orientation')
      ])
    ]);
  }
github ornicar / chessground / examples / src / main.ts View on Github external
function render() {
    return h('div#chessground-examples', [
      h('menu', examples.map((ex, id) => {
        return h('a', {
          class: {
            active: example.name === ex.name
          },
          on: { click: () => page(`/${id}`) }
        }, ex.name);
      })),
      h('section', [
        h('div.chessground.wood.small.merida.coordinates', {
          hook: {
            insert: runExample,
            postpatch: runExample
          }
        }),
        h('p', example.name)
      ]),
      h('control', [
        h('button', { on: { click() { cg.toggleOrientation(); }}}, 'Toggle orientation')
      ])
    ]);
  }