react-native-cp-update-button
Version:
The goal of this component is to make the workflow of letting your users explicitly update the app as simple as CodePush.sync()
26 lines (22 loc) • 617 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var makeCancelable = function makeCancelable(promise) {
var hasCanceled_ = false;
var wrappedPromise = new Promise(function (resolve, reject) {
promise.then(function (val) {
return hasCanceled_ ? reject({ isCanceled: true }) : resolve(val);
});
promise.catch(function (error) {
return hasCanceled_ ? reject({ isCanceled: true }) : reject(error);
});
});
return {
promise: wrappedPromise,
cancel: function cancel() {
hasCanceled_ = true;
}
};
};
exports.default = makeCancelable;