diff --git a/crates/napi/src/threadsafe_function.rs b/crates/napi/src/threadsafe_function.rs index a6e791b8..132dffe8 100644 --- a/crates/napi/src/threadsafe_function.rs +++ b/crates/napi/src/threadsafe_function.rs @@ -208,6 +208,12 @@ impl Clone for ThreadsafeFunction { } } +impl FromNapiValue for ThreadsafeFunction { + unsafe fn from_napi_value(env: sys::napi_env, napi_val: sys::napi_value) -> Result { + Self::create(env, napi_val, 0, |ctx| Ok(vec![ctx.value])) + } +} + impl ThreadsafeFunction { /// See [napi_create_threadsafe_function](https://nodejs.org/api/n-api.html#n_api_napi_create_threadsafe_function) /// for more information.