From e318ae77295e8b2f348ca81a140924750dfc8999 Mon Sep 17 00:00:00 2001 From: jrobinso <933148+jrobinso@users.noreply.github.com> Date: Wed, 25 Oct 2023 12:12:58 -0700 Subject: [PATCH] New Browser method "browser.getTrackURLs" => returns Set of all loaded track urls --- dev/ucsc/slowHub.html | 1 + js/browser.js | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/dev/ucsc/slowHub.html b/dev/ucsc/slowHub.html index 31f50510d..29bcc4dc3 100644 --- a/dev/ucsc/slowHub.html +++ b/dev/ucsc/slowHub.html @@ -31,6 +31,7 @@ //igvConfig.reference.chromAliasBbURL = undefined // TODO <- chromAliasBB is slowish const browser = await igv.createBrowser(document.getElementById('igvDiv'), igvConfig) + console.log(browser.getTrackURLs()) diff --git a/js/browser.js b/js/browser.js index e568148c8..640273008 100755 --- a/js/browser.js +++ b/js/browser.js @@ -1256,6 +1256,7 @@ class Browser { return this.trackViews.filter(tv => tv.track && tv.track.name).map(tv => tv.track.name) } + /** * NOTE: Public API function * @@ -1338,6 +1339,14 @@ class Browser { return this.trackViews.map(tv => tv.track).filter(t => t !== undefined) } + + getTrackURLs() { + return new Set(this.tracks + .filter(track => track.config && StringUtils.isString(track.config.url)) + .map(track => track.config.url)) + } + + /** * Set the track height globally for all tracks. (Note: Its not clear why this is useful). * @param newHeight