igv.JS developer question

149 views
Skip to first unread message

Matthew Maher

unread,
Feb 1, 2016, 12:04:37 PM2/1/16
to igv-help
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!)

James Robinson

unread,
Feb 1, 2016, 12:10:25 PM2/1/16
to igv-...@googlegroups.com
Hi Matthew,

There is not an orderly way to do this right now.   I opened a git issue which you can follow here:  https://github.com/igvteam/igv.js/issues/159.

Could you elaborate on the use-case a little bit, either here or (preferred) as a comment on the git issue?   Specifically, do you just want to blast the current instance and start fresh with a new one,  or rather run 2 instances at the same time?

Jim

Reply all
Reply to author
Forward
0 new messages