Consistent composition order (#2209)

* ensure composition loads in specified order

* Remove Modern JS to match current style guide
This commit is contained in:
Pete Richards 2018-11-07 10:07:57 -08:00 committed by Andrew Henry
parent e710cafb2c
commit 4bda4080d2

View File

@ -177,7 +177,15 @@ define([
CompositionCollection.prototype.load = function () {
return this.provider.load(this.domainObject)
.then(function (children) {
return Promise.all(children.map(this.onProviderAdd, this));
return Promise.all(children.map(function (c) {
return this.publicAPI.objects.get(c);
}, this));
}.bind(this))
.then(function (childObjects) {
childObjects.forEach(function (c) {
this.add(c, true);
}, this);
return childObjects;
}.bind(this))
.then(function (children) {
this.emit('load');