From 3da8daf192bbae52bdd5526624261018f21bcb72 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Sat, 10 Oct 2020 18:21:11 +0800 Subject: [PATCH] feat(napi): implement napi_reference_ref --- napi/src/js_values/value_ref.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/napi/src/js_values/value_ref.rs b/napi/src/js_values/value_ref.rs index c130e9d9..4f49957a 100644 --- a/napi/src/js_values/value_ref.rs +++ b/napi/src/js_values/value_ref.rs @@ -32,6 +32,11 @@ impl Ref { }) } + pub fn reference(&mut self, env: &Env) -> Result { + check_status(unsafe { sys::napi_reference_ref(env.0, self.raw_ref, &mut self.count) })?; + Ok(self.count) + } + #[must_use] pub fn unref(mut self, env: Env) -> Result { check_status(unsafe { sys::napi_reference_unref(env.0, self.raw_ref, &mut self.count) })?;