feat(napi): implement napi_reference_ref
This commit is contained in:
parent
e0d75d1453
commit
3da8daf192
1 changed files with 5 additions and 0 deletions
|
@ -32,6 +32,11 @@ impl<T> Ref<T> {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn reference(&mut self, env: &Env) -> Result<u32> {
|
||||
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<u32> {
|
||||
check_status(unsafe { sys::napi_reference_unref(env.0, self.raw_ref, &mut self.count) })?;
|
||||
|
|
Loading…
Reference in a new issue