程序代写代做代考 Java javascript ## New
## 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::Undefined()
– Nan::Null()
– Nan::True()
– Nan::False()
– Nan::EmptyString()
`Nan::New()` should be used to instantiate new JavaScript objects.
Refer to the specific V8 type in the [V8 documentation](https://v8docs.nodesource.com/io.js-3.0/d1/d83/classv8_1_1_data.html) 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
Empty objects:
“`c++
Nan::New
“`
Generic single and multiple-argument:
“`c++
Nan::New
Nan::New
Nan::New
Nan::New
“`
For creating `v8::FunctionTemplate` and `v8::Function` objects:
_The definition of `Nan::FunctionCallback` can be found in the [Method declaration](./methods.md#api_nan_method) documentation._
“`c++
Nan::New
v8::Local
Nan::New
v8::Local
A2 a2 = A2());
“`
Native number types:
“`c++
v8::Local
v8::Local
v8::Local
v8::Local
“`
String types:
“`c++
Nan::MaybeLocal
Nan::MaybeLocal
Nan::MaybeLocal
Nan::MaybeLocal
Nan::MaybeLocal
“`
Specialized types:
“`c++
v8::Local
v8::Local
v8::Local
“`
Note that `Nan::ExternalOneByteStringResource` maps to [`v8::String::ExternalOneByteStringResource`](https://v8docs.nodesource.com/io.js-3.0/d9/db3/classv8_1_1_string_1_1_external_one_byte_string_resource.html), and `v8::String::ExternalAsciiStringResource` in older versions of V8.
A helper method to reference the `v8::Undefined` object in a way that is compatible across all supported versions of V8.
Signature:
“`c++
v8::Local
“`
A helper method to reference the `v8::Null` object in a way that is compatible across all supported versions of V8.
Signature:
“`c++
v8::Local
“`
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:
“`c++
v8::Local
“`
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:
“`c++
v8::Local
“`
Call [`v8::String::Empty`](https://v8docs.nodesource.com/io.js-3.0/d2/db3/classv8_1_1_string.html#a7c1bc8886115d7ee46f1d571dd6ebc6d) to reference the empty string in a way that is compatible across all supported versions of V8.
Signature:
“`c++
v8::Local
“`
An implementation of [`v8::String::NewFromOneByte()`](https://v8docs.nodesource.com/io.js-3.0/d2/db3/classv8_1_1_string.html#a5264d50b96d2c896ce525a734dc10f09) provided for consistent availability and API across supported versions of V8. Allocates a new string from Latin-1 data.
Signature:
“`c++
Nan::MaybeLocal
int length = -1)
“`