dasmoth / dalliance

Interactive web-based genome browser.
http://www.biodalliance.org/
BSD 2-Clause "Simplified" License
226 stars 68 forks source link

Init browser if document has already loaded #56

Closed sonicdoe closed 10 years ago

sonicdoe commented 10 years ago

I had problems embedding Dalliance as I instantiated the browser after the load event has been fired. This commit adds a check if document.readyState is already complete in which case realInit() is called right away. According to MDN document.readyState === 'complete' is equal to the load event.

Traksewt commented 10 years ago

great, i just hit this problem myself.

dasmoth commented 10 years ago

Thanks. Previously, people have been calling realInit() manually, but this is a much nicer solution. There's already a check in realInit that should prevent accidental multiple initialisation.