Optional
Called when cancelTask() is invoked for this task. Use this to propagate cancellation to the backend, e.g. by invoking a cancel command or aborting an in-flight request.
const taskId = await startTask("heavy_op", { slot: 1 }, { onCancel: () => invoke("cancel_heavy_op", { taskId }),}); Copy
const taskId = await startTask("heavy_op", { slot: 1 }, { onCancel: () => invoke("cancel_heavy_op", { taskId }),});
Called when cancelTask() is invoked for this task. Use this to propagate cancellation to the backend, e.g. by invoking a cancel command or aborting an in-flight request.