Skip to content

detect element mount #130

Answered by Lightnet
Lightnet asked this question in Q&A
Sep 28, 2023 · 2 comments · 5 replies
Discussion options

You must be logged in to vote

Sorry. It took time to do some work. Is there way to detect element add to document render.

const renderEL = () => {

  function init(){
    //const renderer = new THREE.WebGLRenderer();
    console.log(document.getElementById('test'));//null
  }

  init();

  return div(
    div({id:'test'}) //check if added to element
  )
}
van.add(document.body, renderEL())

Might be incorrect way to set up. I wanted to see if there way to detect element change. I guess it not render yet.

const renderEL = () => {

  const render = div({id:'test'})
  function init(){
    //const renderer = new THREE.WebGLRenderer();
    console.log(render);//
  }

  init();

  return div(
    div(
      render
    )
  )…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
2 replies
@Lightnet
Comment options

Answer selected by Tao-VanJS
@Tao-VanJS
Comment options

Comment options

You must be logged in to vote
3 replies
@Tao-VanJS
Comment options

@Hunter-Gu
Comment options

@Tao-VanJS
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants