Example #1
0
File: core.js Project: huckjs/core
 component.onChange(() => {
   Dom.render(this.root, component.render())
   setTimeout(() => {
     console.log('blah')
     this.router.buildLinks()
   }, 100)
 })
Example #2
0
File: core.js Project: huckjs/core
  render(component) {

    // RENDER INITIAL COMPONENT
    Dom.render(this.root, component.content)

    setTimeout(() => {
      this.router.buildLinks()
    }, 100)

    // RE-RENDER COMPONENT WHEN DATA CHANGES
    if (typeof component.onChange === 'function') {
      component.onChange(() => {
        Dom.render(this.root, component.render())
        setTimeout(() => {
          console.log('blah')
          this.router.buildLinks()
        }, 100)
      })
    }

  }