Skip to content

Commit 2f7f8c2

Browse files
committed
export mxPromiseStatus() as fxPromiseIsPending()
1 parent 6b48fff commit 2f7f8c2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

xs/sources/xsPromise.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1427,6 +1427,16 @@ void fxRunPromiseJobs(txMachine* the)
14271427
}
14281428

14291429

1430-
1430+
txS1 fxPromiseIsPending(txMachine* the, txSlot* instance) {
1431+
if (instance->kind != XS_REFERENCE_KIND) {
1432+
return 0;
1433+
}
1434+
txSlot *promise = instance->value.reference;
1435+
if (!mxIsPromise(promise)) {
1436+
return 0;
1437+
}
1438+
txSlot* status = mxPromiseStatus(promise);
1439+
return status->value.integer == mxPendingStatus;
1440+
}
14311441

14321442

0 commit comments

Comments
 (0)