diff --git a/crates/napi/src/bindgen_runtime/js_values/task.rs b/crates/napi/src/bindgen_runtime/js_values/task.rs index 5c91ad4f..a98942e9 100644 --- a/crates/napi/src/bindgen_runtime/js_values/task.rs +++ b/crates/napi/src/bindgen_runtime/js_values/task.rs @@ -35,6 +35,13 @@ impl AsyncTask { abort_signal: Some(signal), } } + + pub fn with_optional_signal(task: T, signal: Option) -> Self { + Self { + inner: task, + abort_signal: signal, + } + } } /// https://developer.mozilla.org/zh-CN/docs/Web/API/AbortController