AsyncOptions
Optional trailing argument on all six *Async exports for cooperative cancellation.
interface AsyncOptions {
signal?: AbortSignal;
}
When signal is aborted before or during work, the Promise rejects with AbortError (DOMException on Node 18+). Long-running C++ paths (Monte Carlo, exact enumeration, evaluator benchmark, decideAction MC) poll the signal and stop promptly.
const ac = new AbortController();
const pending = poker.simulateHandOutcomeAsync(
['Ah', 'Kh'],
['Qh', 'Jh', '2c'],
500_000,
42,
1,
{ signal: ac.signal },
);
// ac.abort(); // rejects pending with AbortError
Applies to: simulateHandOutcomeAsync, parallelHandSimulationAsync, exactHuEquityVsRandomHandAsync, straightMadeFlopToRiverExactProbabilityAsync, decideActionAsync, benchmarkEvaluatorThroughputAsync.