mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-06-10 07:10:36 +08:00
Properly wrap sdk.queryUpdateWithCurrentPackage in a promise
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user