Files
agency/.pnpm-store/v3/files/0e/5aa34cedfc6c723fcadb47a31897f8b9778a3794e41559cada57cb2e4aed67517316aaa9b48906c8d0f7c2c32696bdacd548482ad41678735aeae9edb696d2
hanzo-agent 5af6960b87 run project
Run: sess_f37640604ae254cb4d11dc6217f7b721
2026-09-30 00:04:56 +00:00

49 lines
961 B
Plaintext

// src/thenable.ts
import { noop } from "./utils.js";
function pendingThenable() {
let resolve;
let reject;
const thenable = new Promise((_resolve, _reject) => {
resolve = _resolve;
reject = _reject;
});
thenable.status = "pending";
thenable.catch(() => {
});
function finalize(data) {
Object.assign(thenable, data);
delete thenable.resolve;
delete thenable.reject;
}
thenable.resolve = (value) => {
finalize({
status: "fulfilled",
value
});
resolve(value);
};
thenable.reject = (reason) => {
finalize({
status: "rejected",
reason
});
reject(reason);
};
return thenable;
}
function tryResolveSync(promise) {
let data;
promise.then((result) => {
data = result;
return result;
}, noop)?.catch(noop);
if (data !== void 0) {
return { data };
}
return void 0;
}
export {
pendingThenable,
tryResolveSync
};
//# sourceMappingURL=thenable.js.map