Properly wrap sdk.queryUpdateWithCurrentPackage in a promise

This commit is contained in:
Will Anderson
2015-09-01 15:20:18 -07:00
parent 543296424b
commit 777b9b6fc4

View File

@@ -46,7 +46,7 @@ var getSdk = (() => {
}
})();
function checkForUpdate(callback) {
function checkForUpdate() {
var config;
var sdk;
return getConfiguration()
@@ -64,7 +64,12 @@ function checkForUpdate(callback) {
queryPackage = localPackage;
}
sdk.queryUpdateWithCurrentPackage(queryPackage, callback);
return new Promise((resolve, reject) => {
sdk.queryUpdateWithCurrentPackage(queryPackage, (err, update) => {
if (err) return reject(err);
resolve(update);
});
});
});
}