diff --git a/package.json b/package.json index acb85d2a..130935af 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "genoverse", - "version": "4.0.2", + "version": "4.0.3", "description": "Genoverse is a portable, customizable, back-end independent JavaScript and HTML5 based genome browser which allows the user to explore data in a dynamic and interactive manner.", "main": "src/js/Genoverse.js", "directories": { diff --git a/src/js/Genoverse.js b/src/js/Genoverse.js index f57b6ddb..c3f1922c 100644 --- a/src/js/Genoverse.js +++ b/src/js/Genoverse.js @@ -146,17 +146,20 @@ const Genoverse = Base.extend({ this.loadedPlugins[plugin.name] = true; }; - const pluginImports = Object.keys(pluginsByName).map(pluginName => import(`./plugins/${pluginName}`).then( - (imported) => { - initializePlugin({ - name : pluginName, - conf : pluginsByName[pluginName].conf, - exports : imported.default, - }); - } - )); + const pluginImports = Object.keys(pluginsByName).reduce( + (ready, pluginName) => ready.then( + () => import(`./plugins/${pluginName}`).then( + imported => initializePlugin({ + name : pluginName, + conf : pluginsByName[pluginName].conf, + exports : imported.default, + }) + ) + ), + this.jQuery.Deferred().resolve() + ); - return this.jQuery.when(...pluginImports); + return this.jQuery.when(pluginImports); }, init: function () { @@ -543,7 +546,7 @@ const Genoverse = Base.extend({ onTracks: function (func, ...args) { this.tracks.forEach( (track) => { - if (track.disabled) { + if (track.disabled || !track._interface) { // if track._interface is undefined, the track has not been fully initialized yet return; } diff --git a/src/js/plugins/focusRegion.js b/src/js/plugins/focusRegion.js index 16af5812..b61308d2 100644 --- a/src/js/plugins/focusRegion.js +++ b/src/js/plugins/focusRegion.js @@ -1,13 +1,13 @@ -import './controlPanel'; +import controlPanel from './controlPanel'; const plugin = function () { this.controls.push({ - icon : '', - 'class' : 'gv-button-large', - name : `Reset focus to ${this.focusRegion && this.focusRegion.name ? this.focusRegion.name : `${this.chr}:${this.start}-${this.end}`}`, - action : (browser) => { browser.moveTo(browser.focusRegion.chr, browser.focusRegion.start, browser.focusRegion.end, true); }, - init : (browser) => { browser.focusRegion = browser.focusRegion || { chr: browser.chr, start: browser.start, end: browser.end }; }, + icon : '', + class : 'gv-button-large', + name : `Reset focus to ${this.focusRegion && this.focusRegion.name ? this.focusRegion.name : `${this.chr}:${this.start}-${this.end}`}`, + action : (browser) => { browser.moveTo(browser.focusRegion.chr, browser.focusRegion.start, browser.focusRegion.end, true); }, + init : (browser) => { browser.focusRegion = browser.focusRegion || { chr: browser.chr, start: browser.start, end: browser.end }; }, }); }; -export default { focusRegion: plugin }; +export default { focusRegion: plugin, requires: controlPanel };