Commit 213e724c authored by marcel's avatar marcel
Browse files

Load extensions on client-side only if its extension.js file exists.

parent 569f17ff
......@@ -40,16 +40,21 @@ define(["jquery", "emitter", "vispa/module", "vispa/ui"], function($, Emitter, M
loadExtension: function(name) {
var self = this;
this.extensionsLoading++;
require(["extensions/"+name+"/static/js/extension"],
this.registerExtension.bind(this),
function(err) {
// check if the entry point, i.e. the extension.js file, exists
var entryPoint = "extensions/" + name + "/static/js/extension";
$.ajax({ url: entryPoint + ".js", type: "HEAD" }).fail(function() {
self._checkExtensionsLoaded();
}).done(function() {
require([entryPoint], self.registerExtension.bind(self), function(err) {
if (vispa.args.global.devMode) {
self.logger.error("extension '%s' failed to load due to: %s",
err.requireModules[0].split("/")[1], err.requireType);
}
self._checkExtensionsLoaded();
});
});
},
start: function start() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment