Skip to content

Commit

Permalink
Fix promise usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
mramato committed Jun 13, 2017
1 parent ba612d5 commit b45579b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Source/Scene/Cesium3DTileStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ define([
function Cesium3DTileStyle(style) {
this._style = undefined;
this._ready = false;
this._readyPromise = when.defer();
this._color = undefined;
this._show = undefined;
this._pointSize = undefined;
Expand All @@ -78,19 +77,17 @@ define([
this._showShaderFunctionReady = false;
this._pointSizeShaderFunctionReady = false;

var that = this;
var promise;
if (typeof style === 'string') {
promise = RequestScheduler.request(style, loadJson);
} else {
promise = when.resolve(style);
}

promise.then(function(styleJson) {
var that = this;
this._readyPromise = promise.then(function(styleJson) {
setup(that, styleJson);
that._readyPromise.resolve(that);
}).otherwise(function(error) {
that._readyPromise.reject(error);
return that;
});
}

Expand Down

0 comments on commit b45579b

Please sign in to comment.