feat(napi): implement create_array
This commit is contained in:
parent
5025ffa791
commit
e559908b76
1 changed files with 6 additions and 0 deletions
|
@ -215,6 +215,12 @@ impl Env {
|
|||
Ok(JsObject::from_raw_unchecked(self.0, raw_value))
|
||||
}
|
||||
|
||||
pub fn create_array(&self) -> Result<JsObject> {
|
||||
let mut raw_value = ptr::null_mut();
|
||||
check_status(unsafe { sys::napi_create_array(self.0, &mut raw_value) })?;
|
||||
Ok(JsObject::from_raw_unchecked(self.0, raw_value))
|
||||
}
|
||||
|
||||
pub fn create_array_with_length(&self, length: usize) -> Result<JsObject> {
|
||||
let mut raw_value = ptr::null_mut();
|
||||
check_status(unsafe {
|
||||
|
|
Loading…
Reference in a new issue