Skip to content

Commit

Permalink
Fix methods of LazyPromise (#1059)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlfwong authored and devongovett committed Mar 28, 2018
1 parent 32c796d commit 74438d4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/builtins/bundle-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ function LazyPromise(executor) {
}

LazyPromise.prototype.then = function (onSuccess, onError) {
return this.promise || (this.promise = new Promise(this.executor).then(onSuccess, onError));
if (this.promise === null) this.promise = new Promise(this.executor)
return this.promise.then(onSuccess, onError)
};

LazyPromise.prototype.catch = function (onError) {
return this.promise || (this.promise = new Promise(this.executor).catch(onError));
if (this.promise === null) this.promise = new Promise(this.executor)
return this.promise.catch(onError)
};

0 comments on commit 74438d4

Please sign in to comment.