next
Version:
The React Framework
36 lines (34 loc) • 1.13 kB
JavaScript
/**
* Create data fetching record for Promise.
*/ // TODO-APP: change `any` to type inference.
;
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "createRecordFromThenable", {
enumerable: true,
get: function() {
return createRecordFromThenable;
}
});
function createRecordFromThenable(thenable) {
thenable.status = "pending";
thenable.then((value)=>{
if (thenable.status === "pending") {
thenable.status = "fulfilled";
thenable.value = value;
}
}, (err)=>{
if (thenable.status === "pending") {
thenable.status = "rejected";
thenable.value = err;
}
});
return thenable;
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=create-record-from-thenable.js.map