How to use the incremental-dom.currentComponent 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 node-organic / organic-oval / engines / incremental-dom.js View on Github external
createdElement.on(name, parsedAttrs.handlers[name])
          }
          appendChilds(kids)
          createdElement.connectedCallback()
        } else {
          appendChilds(kids)
          createdElement.shouldUpdate(parsedAttrs.props)
        }
      } else {
        let hasNotRenderedChildren = kids && createdElement && createdElement.children.length === 0 && kids.length !== 0
        if (hasNotRenderedChildren || !parsedAttrs.attrs['freeze']) {
          appendChilds(kids)
        }
      }
      IncrementalDOM.elementClose(tagName.toLowerCase())
      IncrementalDOM.currentComponent = null
    }
  })
github node-organic / organic-oval / engines / incremental-dom.js View on Github external
return function () {
      tagName = tagName.toUpperCase()
      kids = cleanUpKids(kids)
      var parsedAttrs = parseAttrsObj(props)
      if (tagName === 'VIRTUAL') return appendChilds(kids)
      if (tagName === 'SLOT' && component.kids[props.name]) {
        let slot = component.kids[props.name]
        tagName = slot.tagName
        props = slot.props
        kids = slot.kids
      }
      if (props.slot) {
        let cleanprops = {...props}
        delete cleanprops.slot
        IncrementalDOM.currentComponent.kids[props.slot] = {
          props: cleanprops,
          kids: kids,
          tagName: tagName
        }
        return
      }
      IncrementalDOM.elementOpenStart(tagName.toLowerCase(), parsedAttrs.oid)
      for (let key in parsedAttrs.attrs) {
        IncrementalDOM.attr(key, parsedAttrs.attrs[key])
      }
      if (!components[tagName]) {
        for (let key in parsedAttrs.props) {
          IncrementalDOM.attr(key, parsedAttrs.props[key])
        }
        for (let key in parsedAttrs.handlers) {
          IncrementalDOM.attr('on' + key, parsedAttrs.handlers[key])