New
NAN provides a Nan::New()
helper for the creation of new JavaScript objects in a way that's compatible across the supported versions of V8.
Nan::New()
Nan::New()
should be used to instantiate new JavaScript objects.
Refer to the specific V8 type in the V8 documentation for information on the types of arguments required for instantiation.
Signatures:
Return types are mostly omitted from the signatures for simplicity. In most cases the type will be contained within a v8::Local<T>
. The following types will be contained within a Nan::MaybeLocal<T>
: v8::String
, v8::Date
, v8::RegExp
, v8::Script
, v8::UnboundScript
.
Empty objects:
Generic single and multiple-argument:
For creating v8::FunctionTemplate
and v8::Function
objects:
The definition of Nan::FunctionCallback
can be found in the Method declaration documentation.
Native number types:
String types:
Specialized types:
Note that Nan::ExternalOneByteStringResource
maps to v8::String::ExternalOneByteStringResource
, and v8::String::ExternalAsciiStringResource
in older versions of V8.
Nan::Undefined()
A helper method to reference the v8::Undefined
object in a way that is compatible across all supported versions of V8.
Signature:
Nan::Null()
A helper method to reference the v8::Null
object in a way that is compatible across all supported versions of V8.
Signature:
Nan::True()
A helper method to reference the v8::Boolean
object representing the true
value in a way that is compatible across all supported versions of V8.
Signature:
Nan::False()
A helper method to reference the v8::Boolean
object representing the false
value in a way that is compatible across all supported versions of V8.
Signature:
Nan::EmptyString()
Call v8::String::Empty
to reference the empty string in a way that is compatible across all supported versions of V8.
Signature:
Nan::NewOneByteString()
An implementation of v8::String::NewFromOneByte()
provided for consistent availability and API across supported versions of V8. Allocates a new string from Latin-1 data.
Signature:
Last updated