Skip to content

CancelReasonSymbol

const CancelReasonSymbol: unique symbol;

Defined in: symbols.ts:73

Symbol key for the reason passed to the last cancel(reason) of a defer/deferSync (or the signal’s abort reason), or undefined. Same value as its .cancelReason property; resume() clears it.

import { CancelReasonSymbol, defer } from "@xtandard/lib";
const rollback = defer(() => db.query("ROLLBACK"));
rollback.cancel("committed");
rollback[CancelReasonSymbol]; // "committed"
rollback.resume();
rollback[CancelReasonSymbol]; // undefined