javascriptx3dom

Does X3DOM have any "finished loading" events?


I am trying to use X3DOM to display an HTML5 animation, and am trying to attach listeners to my X3DOM event but I want to wait until the X3DOM content is fully loaded and ready to go before attaching the listeners, as in some cases listeners can be attached "too early" (i.e. while the X3DOM content is still loading. This leads to strange behaviour, where event handlers are not called (I'm guessing this is because they do not attach successfully).

Does X3DOM have any specific "fully-loaded" events that can be caught?

Thanks!


Solution

  • You can use the x3dom.runtime.ready variable

    x3dom.runtime.ready = function() {
        console.log("Call before the first rendering");
    }
    

    see Runtime documentation