Struct napi::JsGlobal

source ·
pub struct JsGlobal(_);

Implementations§

source§

impl JsGlobal

source

pub fn set_interval( &self, handler: JsFunction, interval: f64 ) -> Result<JsTimeout>

source

pub fn clear_interval(&self, timer: JsTimeout) -> Result<JsUndefined>

source

pub fn set_timeout( &self, handler: JsFunction, interval: f64 ) -> Result<JsTimeout>

source

pub fn clear_timeout(&self, timer: JsTimeout) -> Result<JsUndefined>

source§

impl JsGlobal

source

pub fn into_unknown(self) -> JsUnknown

source

pub fn coerce_to_bool(self) -> Result<JsBoolean>

source

pub fn coerce_to_number(self) -> Result<JsNumber>

source

pub fn coerce_to_string(self) -> Result<JsString>

source

pub fn coerce_to_object(self) -> Result<JsObject>

source

pub fn is_date(&self) -> Result<bool>

source

pub fn is_promise(&self) -> Result<bool>

source

pub fn is_error(&self) -> Result<bool>

source

pub fn is_typedarray(&self) -> Result<bool>

source

pub fn is_dataview(&self) -> Result<bool>

source

pub fn is_array(&self) -> Result<bool>

source

pub fn is_buffer(&self) -> Result<bool>

source

pub fn instanceof<Constructor>(&self, constructor: Constructor) -> Result<bool>where Constructor: NapiRaw,

source§

impl JsGlobal

source

pub fn set_property<K, V>(&mut self, key: K, value: V) -> Result<()>where K: NapiRaw, V: NapiRaw,

source

pub fn get_property<K, T>(&self, key: K) -> Result<T>where K: NapiRaw, T: NapiValue,

source

pub fn get_property_unchecked<K, T>(&self, key: K) -> Result<T>where K: NapiRaw, T: NapiValue,

source

pub fn set_named_property<T>(&mut self, name: &str, value: T) -> Result<()>where T: ToNapiValue,

source

pub fn create_named_method( &mut self, name: &str, function: Callback ) -> Result<()>

source

pub fn get_named_property<T>(&self, name: &str) -> Result<T>where T: FromNapiValue,

source

pub fn get_named_property_unchecked<T>(&self, name: &str) -> Result<T>where T: FromNapiValue,

source

pub fn has_named_property(&self, name: &str) -> Result<bool>

source

pub fn delete_property<S>(&mut self, name: S) -> Result<bool>where S: NapiRaw,

source

pub fn delete_named_property(&mut self, name: &str) -> Result<bool>

source

pub fn has_own_property(&self, key: &str) -> Result<bool>

source

pub fn has_own_property_js<K>(&self, key: K) -> Result<bool>where K: NapiRaw,

source

pub fn has_property(&self, name: &str) -> Result<bool>

source

pub fn has_property_js<K>(&self, name: K) -> Result<bool>where K: NapiRaw,

source

pub fn get_property_names(&self) -> Result<JsObject>

source

pub fn get_all_property_names( &self, mode: KeyCollectionMode, filter: KeyFilter, conversion: KeyConversion ) -> Result<JsObject>

source

pub fn get_prototype<T>(&self) -> Result<T>where T: NapiValue,

This returns the equivalent of Object.getPrototypeOf (which is not the same as the function’s prototype property).

source

pub fn get_prototype_unchecked<T>(&self) -> Result<T>where T: NapiValue,

source

pub fn set_element<T>(&mut self, index: u32, value: T) -> Result<()>where T: NapiRaw,

source

pub fn has_element(&self, index: u32) -> Result<bool>

source

pub fn delete_element(&mut self, index: u32) -> Result<bool>

source

pub fn get_element<T>(&self, index: u32) -> Result<T>where T: NapiValue,

source

pub fn get_element_unchecked<T>(&self, index: u32) -> Result<T>where T: NapiValue,

source

pub fn define_properties(&mut self, properties: &[Property]) -> Result<()>

This method allows the efficient definition of multiple properties on a given object.

source

pub fn get_array_length(&self) -> Result<u32>

Perform is_array check before get the length if Object is not array, ArrayExpected error returned

source

pub fn get_array_length_unchecked(&self) -> Result<u32>

use this API if you can ensure this Object is Array

source

pub fn freeze(&mut self) -> Result<()>

source

pub fn seal(&mut self) -> Result<()>

Trait Implementations§

source§

impl<'env> NapiRaw for &'env JsGlobal

source§

unsafe fn raw(&self) -> napi_value

source§

impl NapiRaw for JsGlobal

source§

unsafe fn raw(&self) -> napi_value

source§

impl NapiValue for JsGlobal

source§

impl TryFrom<JsUnknown> for JsGlobal

§

type Error = Error<Status>

The type returned in the event of a conversion error.
source§

fn try_from(value: JsUnknown) -> Result<JsGlobal>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> JsValuesTupleIntoVec for Twhere T: ToNapiValue,

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.