feat(napi): implement with_optional_signal on AsyncTask
This commit is contained in:
parent
43c1aff738
commit
c77712e76f
1 changed files with 7 additions and 0 deletions
|
@ -35,6 +35,13 @@ impl<T: Task> AsyncTask<T> {
|
|||
abort_signal: Some(signal),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_optional_signal(task: T, signal: Option<AbortSignal>) -> Self {
|
||||
Self {
|
||||
inner: task,
|
||||
abort_signal: signal,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// https://developer.mozilla.org/zh-CN/docs/Web/API/AbortController
|
||||
|
|
Loading…
Reference in a new issue