Skip to content

Child element NOT re-drawing #11

@codemeasandwich

Description

@codemeasandwich

Child element NOT re-drawing

class APerson extends hyperElement{
  
  onClick(){
    this.attrs.hi("Hello from "+this.attrs.name)
  } // note/helper : fucntion automatically have the element "this" bound
  
  render(Html){
    console.log("Re-draw?")
    Html`${this.attrs.name} <button onclick=${this.onClick}>Say hi! ${ this.attrs.x[0].path }</button>`
  } 
}

class UsersElem extends hyperElement{
  setup(onNext){

    const Interval = setInterval(onNext(()=> new Date()),1000)

    return () => clearInterval(Interval);
  }
  onHi(val){
    alert(val)
  }
  render(Html,time){
    console.log("Draw!")
    const yaml = [{path:"foo",data:{}}]
    Html`<a-person hi=${this.onHi} x=${yaml} name=${time+""}></a-person>`
  }
}
window.customElements.define("a-person", APerson)
window.customElements.define("users-elem", UsersElem)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions