This is a developer question related to IGV.js (the embeddable Javascript library, NOT the standalone application, IGV):
I was able to follow the demonstration page and embed
igv.js functionality in my web page. It works great. Very impressive work.
My
only issue is that it seems intended for single-launch use - i.e. if
you twice invoke the "igv.createBrowser(...)" call, you get the error
"Attempt to create 2 browsers". But I am attempting to embed the viewer
within some modal popups that users can open/close at their convenience
(and thus the DOM element into which IGV was initiated goes away at
close).
I got around this issue (sort of) by explicitly destroying the IGV object when the modal popup closes, via:
delete igv['browser'];
And this seems to do the trick - now the modal popups can be opened/closed without problems. But this is no doubt not a recommended method (okay, okay... it's 'criminal') for accomplishing this goal. One tipoff - after doing the above forced destruction, there are console messages like this:
Uncaught TypeError: Cannot read property 'referenceFrame' of undefined
(anonymous function)
igv.throttle
m.event.dispatch
m.event.add.r.handle
so perhaps some IGV event queue still contained messages when I unceremoniously unplugged things.
Is there a recommended orderly way to close down an IGV.js instance so that it can be cleanly started from scratch again?
Thanks (and the tool looks like really impressive work - my compliments!)