How to use the incremental-dom.patchInner function in incremental-dom

To help you get started, we’ve selected a few incremental-dom 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 skatejs / skatejs / src / lifecycle / render.js View on Github external
// Setup the shadow root if it hasn't been setup yet.
    if (!sr) {
      if (shadowDomV1) {
        sr = elem.attachShadow({ mode: 'open' });
      } else if (shadowDomV0) {
        sr = elem.createShadowRoot();
      } else {
        sr = elem;
      }

      elem[$shadowRoot] = sr;
    }

    if (shouldRender) {
      patchInner(sr, () => {
        const possibleFn = render(elem);
        if (typeof possibleFn === 'function') {
          possibleFn();
        } else if (Array.isArray(possibleFn)) {
          possibleFn.forEach((fn) => {
            if (typeof fn === 'function') {
              fn();
            }
          });
        }
      });

      if (rendered) {
        rendered(elem);
      }
    }
github skatejs / skatejs / src / api / element.js View on Github external
rendererCallback () {
      if (!this.shadowRoot) {
        this.attachShadow({ mode: 'open' });
      }
      patchInner(this.shadowRoot, () => {
        const possibleFn = this.renderCallback(this);
        if (isFunction(possibleFn)) {
          possibleFn();
        } else if (Array.isArray(possibleFn)) {
          possibleFn.forEach((fn) => {
            if (isFunction(fn)) {
              fn();
            }
          });
        }
      });
    }