Web Components ready flag <p>We are using Web Components and Polymer on our site, and have quite a few bits of Javascript which wait for the <code>"WebComponentsReady"</code> event to be fired before executing. However, we have some asynchronous JS files which occasionally add an event listener for the event <em>after</em> it has been fired, meaning the script we want to run is never run.</p> <p>Does anyone know if there is a flag for Web Components being ready which can be checked?</p> <p>Something like this is what we would need:</p> <pre><code>if(WebComponents.ready) { // Does this flag, or something similar, exist?? // do stuff } else { document.addEventListener('WebComponentsReady', function() { // do stuff } } </code></pre> <p>Any help appreciated.</p>