The object to query.
The name of the property to delete.
Whether the property deletion succeeded or not.
result can optionally be ignored by passing
This API attempts to delete the own property from
The name of the own property whose existence to check.
Whether the own property exists on the object or not.
This API checks if the passed in has the named own property. must be a string or a, or an error will be thrown.
N-API will not perform any conversion between data types.
The object on which to set the property.
The name of the property to set.
The property value.
This method is equivalent to calling with a created from the string passed in as
The object from which to retrieve the property.
The name of the property to get.
The object from which to set the properties.
The index of the property to set.
This API sets and element on the passed in.
This API gets the element at the requested index.
This API returns if the passed in has an element at the requested index.
Whether the element deletion succeeded or not.
This API attempts to delete the specified from
The number of elements in the array.
The array of property descriptors.
This method allows the efficient definition of multiple properties on a given object.
The properties are defined using property descriptors (see
Given an array of such property descriptors, this API will set the properties on the object one at a time, as defined by (described in Section 9.1.6 of the ECMA262 specification).
The object passed to the called function.
The count of elements in the array.
A sample use case might look as follows.
Then, the above function can be invoked from a native add-on using the following code:
Get the function named "AddTwo" on the global object
Convert the result back to a native type
The name of the function encoded as UTF8.
The native function which should be called when this function object is invoked.
User-provided data context.This will be passed back into the function when invoked later.
In order to expose a function as part of the add-on's module exports, set the newly created function on the exports object. A sample module might look as follows:
The string passed to require is not necessarily the name passed into in the earlier snippet but the name of the target in responsible for creating the file
The callback info passed into the callback function.
Specifies the size of the provided array and receives the actual count of arguments.
Buffer to which the representing the arguments are copied.
If there are more arguments than the provided count, only the requested number of arguments are copied.
If there are fewer arguments provided than claimed, the rest of is filled with values that represent
Receives the data pointer for the callback.
This method is used within a callback function to retrieve details about the call like the arguments and the pointer from a given callback info.
The of the constructor call.
This API returns the of the constructor call.If the current callback is not a constructor call, the result is
The following can be approximated in N-API using the following snippet:
Get the constructor function MyObject
For an instance callback, obtains the C++ instance that is the target of the call.
For wrapped objects it may be difficult to distinguish between a function called on a class prototype and a function called on an instance of a class.
A common pattern used to address this problem is to save a persistent reference to the class constructor for later checks.
The reference must be freed once it is no longer needed.
The length of the in bytes, or if it is null-terminated.
Callback function that handles constructing instances of the class. (This should be a static method on the class, not an actual C++ constructor function.)
Optional data to be passed to the constructor callback as the property of the callback info.
Number of items in the array argument.
Array of property descriptors describing static and instance data properties, accessors, and methods on the class See
A representing the constructor function for the class.
Properties on the constructor function corresponding to static data properties, accessors, and methods of the C++ class (defined by property descriptors with the attribute).
Properties on the constructor function's object corresponding to <1>non-static</1> data properties, accessors, and methods of the C++ class (defined by property descriptors without the attribute).
In that case, to prevent the function value from being garbage-collected, create a persistent reference to it using and ensure the reference count is kept >= 1.
This object must have been created from the of a constructor that was created using
Optional contextual hint that is passed to the finalize callback.
Optional reference to the wrapped object