decord/source/1610_useThenable.js

120 lines
3.2 KiB
JavaScript
Raw Normal View History

2026-08-15 05:55:55 +00:00
// Module ID: 1610
// Function ID: 1611
2026-07-29 08:29:29 +00:00
// Name: useThenable
// Dependencies: [5, 32, 19]
2026-08-06 08:05:19 +00:00
// Exports: useThenable
2026-07-29 08:29:29 +00:00
2026-08-15 05:55:55 +00:00
// Module 1610 (useThenable)
2026-08-24 06:08:38 +00:00
import closure_0 from "asyncGeneratorStep" /* 5 */;
import closure_1 from "_slicedToArray" /* 32 */;
import closure_2 from "noop" /* 19 */;
2026-07-29 08:29:29 +00:00
2026-08-06 08:05:19 +00:00
export const useThenable = function useThenable(arg0) {
2026-07-29 08:29:29 +00:00
const first = items(React.useState(arg0), 1)[0];
items = [false, undefined];
first.then((arg0) => {
2026-08-24 06:08:38 +00:00
items = [true, arg0];
2026-07-29 08:29:29 +00:00
});
2026-08-24 06:08:38 +00:00
[tmp3, closure_2] = items(React.useState(items), 2);
2026-07-29 08:29:29 +00:00
const first1 = items(tmp3, 1)[0];
let items1 = [first, first1];
const effect = React.useEffect(() => {
2026-08-24 06:08:38 +00:00
closure_0 = false;
closure_0 = first(function*() {
2026-07-29 08:29:29 +00:00
if (c5 === 2) {
c5 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp6 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-25 06:04:03 +00:00
return { value: "HermesInternal", done: "HermesInternal" };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c5 = 2;
if (0 === c4) {
if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 === 2) {
c5 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
closure_1 = tmp3;
closure_0 = tmp7;
closure_0 = undefined;
c3 = 1;
2026-07-29 08:29:29 +00:00
c4 = 2;
c5 = 1;
2026-08-24 06:08:38 +00:00
obj1 = { value: null, done: false };
obj1[0] = closure_0;
2026-07-29 08:29:29 +00:00
return obj1;
}
} else if (1 === tmp7) {
c3 = 0;
2026-08-24 06:08:38 +00:00
if (!closure_1_0) {
items = [true, closure_0];
closure_2_2(items);
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
throw closure_2;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 === 2) {
c3 = 0;
2026-08-24 06:08:38 +00:00
if (!closure_1_0) {
const items1 = [true, closure_0];
closure_2_2(items1);
2026-07-29 08:29:29 +00:00
}
c5 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
closure_0 = arg1;
2026-07-29 08:29:29 +00:00
c3 = 0;
2026-08-24 06:08:38 +00:00
if (!closure_1_0) {
const items2 = [true, closure_0];
closure_2_2(items2);
2026-07-29 08:29:29 +00:00
}
c5 = 3;
2026-08-25 06:04:03 +00:00
return { value: "HermesInternal", done: "HermesInternal" };
2026-07-29 08:29:29 +00:00
}
} catch (tmp28) {
2026-08-24 06:08:38 +00:00
closure_2 = tmp28;
2026-07-29 08:29:29 +00:00
if (tmp4 === c3) {
c5 = tmp2;
throw tmp28;
} else {
c4 = tmp;
}
}
}
});
if (!first1) {
(function resolve() {
const self = this;
2026-08-24 06:08:38 +00:00
const apply = closure_0.apply;
2026-07-29 08:29:29 +00:00
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
})();
}
return () => {
2026-08-24 06:08:38 +00:00
c0 = true;
2026-07-29 08:29:29 +00:00
};
}, items1);
return tmp3;
};