fix(napi): allow ErrorStrategy to be specified while creating TSFN
This commit is contained in:
parent
d7da82e269
commit
d1a5f84aa0
6 changed files with 30 additions and 9 deletions
crates/napi/src/js_values
|
@ -120,15 +120,16 @@ impl JsFunction {
|
|||
}
|
||||
|
||||
#[cfg(feature = "napi4")]
|
||||
pub fn create_threadsafe_function<T, V, F>(
|
||||
pub fn create_threadsafe_function<T, V, F, ES>(
|
||||
&self,
|
||||
max_queue_size: usize,
|
||||
callback: F,
|
||||
) -> Result<ThreadsafeFunction<T>>
|
||||
) -> Result<ThreadsafeFunction<T, ES>>
|
||||
where
|
||||
T: 'static,
|
||||
V: NapiRaw,
|
||||
F: 'static + Send + FnMut(ThreadSafeCallContext<T>) -> Result<Vec<V>>,
|
||||
ES: crate::threadsafe_function::ErrorStrategy::T,
|
||||
{
|
||||
ThreadsafeFunction::create(self.0.env, self.0.value, max_queue_size, callback)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue