Skip to content
Snippets Groups Projects
Commit 8a0f269b authored by Piotr Gawron's avatar Piotr Gawron
Browse files

unnecessary promise constructors removed

parent db6fae4c
No related branches found
No related tags found
1 merge request!5Frontend refactor
......@@ -133,7 +133,7 @@ LayoutData.prototype.getFullAliasById = function(id) {
if (alias !== undefined) {
if (alias.getType() === LayoutAlias.LIGTH) {
return ServerConnector.getFullOverlayElement({
element: new IdentifiedElement(alias),
element : new IdentifiedElement(alias),
overlay : self,
}).then(function(data) {
self.updateAlias(data);
......@@ -163,25 +163,20 @@ LayoutData.prototype.getReactions = function() {
LayoutData.prototype.init = function() {
var self = this;
if (this.isInitialized()) {
return new Promise(function(resolve) {
resolve();
});
return Promise.resolve();
}
return new Promise(function(resolve, reject) {
ServerConnector.getOverlayElements(self.getId()).then(function(data) {
for (var i = 0; i < data.length; i++) {
if (data[i] instanceof LayoutAlias) {
self.addAlias(data[i]);
} else if (data[i] instanceof LayoutReaction) {
self.addReaction(data[i]);
} else {
reject("Unknown element type: " + typeof (data[i]));
}
return ServerConnector.getOverlayElements(self.getId()).then(function(data) {
for (var i = 0; i < data.length; i++) {
if (data[i] instanceof LayoutAlias) {
self.addAlias(data[i]);
} else if (data[i] instanceof LayoutReaction) {
self.addReaction(data[i]);
} else {
reject("Unknown element type: " + typeof (data[i]));
}
self.setInitialized(true);
resolve();
}, reject);
}
self.setInitialized(true);
});
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment