Quantumbraid's picture
download
raw
643 Bytes
// The source (has been changed) is https://github.com/facebook/react/issues/5465#issuecomment-157888325
var CANCELATION_MESSAGE = {
type: 'cancelation',
msg: 'operation is manually canceled'
};
function makeCancelable(promise) {
var hasCanceled_ = false;
var wrappedPromise = new Promise(function (resolve, reject) {
promise.then(function (val) {
return hasCanceled_ ? reject(CANCELATION_MESSAGE) : resolve(val);
});
promise["catch"](reject);
});
return wrappedPromise.cancel = function () {
return hasCanceled_ = true;
}, wrappedPromise;
}
export default makeCancelable;
export { CANCELATION_MESSAGE };

Xet Storage Details

Size:
643 Bytes
·
Xet hash:
f577d2341578e8a02588b33f248a658ef10ea784da91d8eb95a0a1adf5539cb6

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.