Commit 5555075b authored by Piotr Gawron's avatar Piotr Gawron
Browse files

plugin is registered on the server before plugin resgister method is called

parent 2fd6bd4c
......@@ -51,6 +51,8 @@ Plugin.prototype.load = function () {
var options = self.getOptions();
var hash;
var error = false;
var registerPromise = null;
return ServerConnector.sendRequest({
url: options.url,
......@@ -59,9 +61,7 @@ Plugin.prototype.load = function () {
}).then(function (content) {
hash = Functions.computeMD5(content);
var pluginData = undefined;
var error = false;
try {
var registerPromise = null;
// noinspection JSUnusedLocalSymbols
var minervaDefine = function (pluginFunction) {
try {
......@@ -86,21 +86,22 @@ Plugin.prototype.load = function () {
error = e;
}
};
content += "//# sourceURL=" + options.url;
eval(content);
} catch (e) {
error = e;
}
if (error) {
return Promise.reject(error);
}
return registerPromise;
}).then(function () {
return ServerConnector.registerPlugin({
hash: hash,
url: options.url,
name: self.getName(),
version: self.getVersion()
});
}).then(function () {
if (error) {
return Promise.reject(error);
}
return registerPromise;
});
};
......
Markdown is supported
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