Skip to content

Commit

Permalink
Promise handling (2nd try)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Hommes authored and Jan Hommes committed Jul 29, 2017
1 parent 9cfcd1c commit 046fb3d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions o.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,12 +447,12 @@
base.get = function (callback, errorCallback) {
// init the q -> if node require a node promise -> if ES6, try ES6 promise
var promise = initPromise();
if (typeof promise !== 'undefined')
if (promise && typeof callback === 'undefined')
currentPromise = promise.defer();

//start the request
startRequest(callback, errorCallback, false);
if (typeof promise !== 'undefined')
if (promise && typeof callback === 'undefined')
return (currentPromise.promise);
else
return (base);
Expand Down
Loading

0 comments on commit 046fb3d

Please sign in to comment.