node-addon-api 3.0.1 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +217 -0
- package/README.md +104 -60
- package/common.gypi +1 -1
- package/index.js +4 -3
- package/napi-inl.deprecated.h +8 -8
- package/napi-inl.h +1206 -540
- package/napi.h +821 -522
- package/package-support.json +21 -0
- package/package.json +80 -4
- package/tools/README.md +8 -2
- package/tools/clang-format.js +67 -0
- package/tools/conversion.js +4 -4
- package/.editorconfig +0 -8
- package/.travis.yml +0 -59
- package/CODE_OF_CONDUCT.md +0 -4
- package/CONTRIBUTING.md +0 -66
- package/appveyor.yml +0 -48
- package/benchmark/README.md +0 -47
- package/benchmark/binding.gyp +0 -25
- package/benchmark/function_args.cc +0 -153
- package/benchmark/function_args.js +0 -52
- package/benchmark/index.js +0 -34
- package/benchmark/property_descriptor.cc +0 -60
- package/benchmark/property_descriptor.js +0 -29
- package/doc/Doxyfile +0 -2450
- package/doc/array_buffer.md +0 -129
- package/doc/async_context.md +0 -86
- package/doc/async_operations.md +0 -31
- package/doc/async_worker.md +0 -427
- package/doc/async_worker_variants.md +0 -456
- package/doc/basic_types.md +0 -423
- package/doc/bigint.md +0 -93
- package/doc/boolean.md +0 -64
- package/doc/buffer.md +0 -140
- package/doc/callback_scope.md +0 -54
- package/doc/callbackinfo.md +0 -97
- package/doc/checker-tool.md +0 -32
- package/doc/class_property_descriptor.md +0 -117
- package/doc/cmake-js.md +0 -68
- package/doc/conversion-tool.md +0 -28
- package/doc/creating_a_release.md +0 -62
- package/doc/dataview.md +0 -244
- package/doc/date.md +0 -68
- package/doc/env.md +0 -132
- package/doc/error.md +0 -115
- package/doc/error_handling.md +0 -186
- package/doc/escapable_handle_scope.md +0 -82
- package/doc/external.md +0 -59
- package/doc/function.md +0 -401
- package/doc/function_reference.md +0 -238
- package/doc/generator.md +0 -13
- package/doc/handle_scope.md +0 -65
- package/doc/memory_management.md +0 -27
- package/doc/node-gyp.md +0 -82
- package/doc/number.md +0 -163
- package/doc/object.md +0 -275
- package/doc/object_lifetime_management.md +0 -83
- package/doc/object_reference.md +0 -117
- package/doc/object_wrap.md +0 -851
- package/doc/prebuild_tools.md +0 -16
- package/doc/promises.md +0 -74
- package/doc/property_descriptor.md +0 -286
- package/doc/range_error.md +0 -59
- package/doc/reference.md +0 -111
- package/doc/setup.md +0 -81
- package/doc/string.md +0 -89
- package/doc/symbol.md +0 -44
- package/doc/threadsafe_function.md +0 -320
- package/doc/type_error.md +0 -59
- package/doc/typed_array.md +0 -74
- package/doc/typed_array_of.md +0 -133
- package/doc/value.md +0 -278
- package/doc/version_management.md +0 -43
- package/doc/working_with_javascript_values.md +0 -14
package/doc/typed_array_of.md
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
# TypedArrayOf
|
|
2
|
-
|
|
3
|
-
The `Napi::TypedArrayOf` class corresponds to the various
|
|
4
|
-
[JavaScript `TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray)
|
|
5
|
-
classes.
|
|
6
|
-
|
|
7
|
-
## Typedefs
|
|
8
|
-
|
|
9
|
-
The common JavaScript `TypedArray` types are pre-defined for each of use:
|
|
10
|
-
|
|
11
|
-
```cpp
|
|
12
|
-
typedef Napi::TypedArrayOf<int8_t> Int8Array;
|
|
13
|
-
typedef Napi::TypedArrayOf<uint8_t> Uint8Array;
|
|
14
|
-
typedef Napi::TypedArrayOf<int16_t> Int16Array;
|
|
15
|
-
typedef Napi::TypedArrayOf<uint16_t> Uint16Array;
|
|
16
|
-
typedef Napi::TypedArrayOf<int32_t> Int32Array;
|
|
17
|
-
typedef Napi::TypedArrayOf<uint32_t> Uint32Array;
|
|
18
|
-
typedef Napi::TypedArrayOf<float> Float32Array;
|
|
19
|
-
typedef Napi::TypedArrayOf<double> Float64Array;
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
The one exception is the `Uint8ClampedArray` which requires explicit
|
|
23
|
-
initialization:
|
|
24
|
-
|
|
25
|
-
```cpp
|
|
26
|
-
Uint8Array::New(env, length, napi_uint8_clamped_array)
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Note that while it's possible to create a "clamped" array the _clamping_
|
|
30
|
-
behavior is only applied in JavaScript.
|
|
31
|
-
|
|
32
|
-
## Methods
|
|
33
|
-
|
|
34
|
-
### New
|
|
35
|
-
|
|
36
|
-
Allocates a new `Napi::TypedArray` instance with a given length. The underlying
|
|
37
|
-
`Napi::ArrayBuffer` is allocated automatically to the desired number of elements.
|
|
38
|
-
|
|
39
|
-
The array type parameter can normally be omitted (because it is inferred from
|
|
40
|
-
the template parameter T), except when creating a "clamped" array.
|
|
41
|
-
|
|
42
|
-
```cpp
|
|
43
|
-
static Napi::TypedArrayOf Napi::TypedArrayOf::New(napi_env env,
|
|
44
|
-
size_t elementLength,
|
|
45
|
-
napi_typedarray_type type);
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
- `[in] env`: The environment in which to create the `Napi::TypedArrayOf` instance.
|
|
49
|
-
- `[in] elementLength`: The length to be allocated, in elements.
|
|
50
|
-
- `[in] type`: The type of array to allocate (optional).
|
|
51
|
-
|
|
52
|
-
Returns a new `Napi::TypedArrayOf` instance.
|
|
53
|
-
|
|
54
|
-
### New
|
|
55
|
-
|
|
56
|
-
Wraps the provided `Napi::ArrayBuffer` into a new `Napi::TypedArray` instance.
|
|
57
|
-
|
|
58
|
-
The array `type` parameter can normally be omitted (because it is inferred from
|
|
59
|
-
the template parameter `T`), except when creating a "clamped" array.
|
|
60
|
-
|
|
61
|
-
```cpp
|
|
62
|
-
static Napi::TypedArrayOf Napi::TypedArrayOf::New(napi_env env,
|
|
63
|
-
size_t elementLength,
|
|
64
|
-
Napi::ArrayBuffer arrayBuffer,
|
|
65
|
-
size_t bufferOffset,
|
|
66
|
-
napi_typedarray_type type);
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
- `[in] env`: The environment in which to create the `Napi::TypedArrayOf` instance.
|
|
70
|
-
- `[in] elementLength`: The length to array, in elements.
|
|
71
|
-
- `[in] arrayBuffer`: The backing `Napi::ArrayBuffer` instance.
|
|
72
|
-
- `[in] bufferOffset`: The offset into the `Napi::ArrayBuffer` where the array starts,
|
|
73
|
-
in bytes.
|
|
74
|
-
- `[in] type`: The type of array to allocate (optional).
|
|
75
|
-
|
|
76
|
-
Returns a new `Napi::TypedArrayOf` instance.
|
|
77
|
-
|
|
78
|
-
### Constructor
|
|
79
|
-
|
|
80
|
-
Initializes an empty instance of the `Napi::TypedArrayOf` class.
|
|
81
|
-
|
|
82
|
-
```cpp
|
|
83
|
-
Napi::TypedArrayOf::TypedArrayOf();
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
### Constructor
|
|
87
|
-
|
|
88
|
-
Initializes a wrapper instance of an existing `Napi::TypedArrayOf` object.
|
|
89
|
-
|
|
90
|
-
```cpp
|
|
91
|
-
Napi::TypedArrayOf::TypedArrayOf(napi_env env, napi_value value);
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
- `[in] env`: The environment in which to create the `Napi::TypedArrayOf` object.
|
|
95
|
-
- `[in] value`: The `Napi::TypedArrayOf` reference to wrap.
|
|
96
|
-
|
|
97
|
-
### operator []
|
|
98
|
-
|
|
99
|
-
```cpp
|
|
100
|
-
T& Napi::TypedArrayOf::operator [](size_t index);
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
- `[in] index: The element index into the array.
|
|
104
|
-
|
|
105
|
-
Returns the element found at the given index.
|
|
106
|
-
|
|
107
|
-
### operator []
|
|
108
|
-
|
|
109
|
-
```cpp
|
|
110
|
-
const T& Napi::TypedArrayOf::operator [](size_t index) const;
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
- `[in] index: The element index into the array.
|
|
114
|
-
|
|
115
|
-
Returns the element found at the given index.
|
|
116
|
-
|
|
117
|
-
### Data
|
|
118
|
-
|
|
119
|
-
```cpp
|
|
120
|
-
T* Napi::TypedArrayOf::Data() const;
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
Returns a pointer into the backing `Napi::ArrayBuffer` which is offset to point to the
|
|
124
|
-
start of the array.
|
|
125
|
-
|
|
126
|
-
### Data
|
|
127
|
-
|
|
128
|
-
```cpp
|
|
129
|
-
const T* Napi::TypedArrayOf::Data() const
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
Returns a pointer into the backing `Napi::ArrayBuffer` which is offset to point to the
|
|
133
|
-
start of the array.
|
package/doc/value.md
DELETED
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
# Value
|
|
2
|
-
|
|
3
|
-
`Napi::Value` is the C++ manifestation of a JavaScript value.
|
|
4
|
-
|
|
5
|
-
Value is a the base class upon which other JavaScript values such as Number, Boolean, String, and Object are based.
|
|
6
|
-
|
|
7
|
-
The following classes inherit, either directly or indirectly, from `Napi::Value`:
|
|
8
|
-
|
|
9
|
-
- [`Napi::Array`](basic_types.md#array)
|
|
10
|
-
- [`Napi::ArrayBuffer`](array_buffer.md)
|
|
11
|
-
- [`Napi::Boolean`](boolean.md)
|
|
12
|
-
- [`Napi::Buffer`](buffer.md)
|
|
13
|
-
- [`Napi::Date`](date.md)
|
|
14
|
-
- [`Napi::External`](external.md)
|
|
15
|
-
- [`Napi::Function`](function.md)
|
|
16
|
-
- [`Napi::Name`](name.md)
|
|
17
|
-
- [`Napi::Number`](number.md)
|
|
18
|
-
- [`Napi::Object`](object.md)
|
|
19
|
-
- [`Napi::String`](string.md)
|
|
20
|
-
- [`Napi::Symbol`](symbol.md)
|
|
21
|
-
- [`Napi::TypedArray`](typed_array.md)
|
|
22
|
-
- [`Napi::TypedArrayOf`](typed_array_of.md)
|
|
23
|
-
|
|
24
|
-
## Methods
|
|
25
|
-
|
|
26
|
-
### Empty Constructor
|
|
27
|
-
|
|
28
|
-
```cpp
|
|
29
|
-
Napi::Value::Value();
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Creates a new *empty* `Napi::Value` instance.
|
|
33
|
-
|
|
34
|
-
### Constructor
|
|
35
|
-
|
|
36
|
-
```cpp
|
|
37
|
-
Napi::Value::Value(napi_env env, napi_value value);
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
- `[in] env`: The `napi_env` environment in which to construct the `Napi::Value` object.
|
|
41
|
-
|
|
42
|
-
- `[in] value`: The C++ primitive from which to instantiate the `Napi::Value`. `value` may be any of:
|
|
43
|
-
- `bool`
|
|
44
|
-
- Any integer type
|
|
45
|
-
- Any floating point type
|
|
46
|
-
- `const char*` (encoded using UTF-8, null-terminated)
|
|
47
|
-
- `const char16_t*` (encoded using UTF-16-LE, null-terminated)
|
|
48
|
-
- `std::string` (encoded using UTF-8)
|
|
49
|
-
- `std::u16string`
|
|
50
|
-
- `Napi::Value`
|
|
51
|
-
- `napi_value`
|
|
52
|
-
|
|
53
|
-
### From
|
|
54
|
-
|
|
55
|
-
```cpp
|
|
56
|
-
template <typename T> static Napi::Value Napi::Value::From(napi_env env, const T& value);
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
- `[in] env`: The `napi_env` environment in which to create the `Napi::Value` object.
|
|
60
|
-
|
|
61
|
-
- `[in] value`: The N-API primitive value from which to create the `Napi::Value` object.
|
|
62
|
-
|
|
63
|
-
Returns a `Napi::Value` object from an N-API primitive value.
|
|
64
|
-
|
|
65
|
-
### operator napi_value
|
|
66
|
-
|
|
67
|
-
```cpp
|
|
68
|
-
operator napi_value() const;
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Returns this Value's N-API value primitive.
|
|
72
|
-
|
|
73
|
-
Returns `nullptr` if this `Napi::Value` is *empty*.
|
|
74
|
-
|
|
75
|
-
### operator ==
|
|
76
|
-
|
|
77
|
-
```cpp
|
|
78
|
-
|
|
79
|
-
bool Napi::Value::operator ==(const Napi::Value& other) const;
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
- `[in] other`: The `Napi::Value` object to be compared.
|
|
83
|
-
|
|
84
|
-
Returns a `bool` indicating if this `Napi::Value` strictly equals another `Napi::Value`.
|
|
85
|
-
|
|
86
|
-
### operator !=
|
|
87
|
-
|
|
88
|
-
```cpp
|
|
89
|
-
bool Napi::Value::operator !=(const Napi::Value& other) const;
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
- `[in] other`: The `Napi::Value` object to be compared.
|
|
93
|
-
|
|
94
|
-
Returns a `bool` indicating if this `Napi::Value` does not strictly equal another `Napi::Value`.
|
|
95
|
-
|
|
96
|
-
### StrictEquals
|
|
97
|
-
|
|
98
|
-
```cpp
|
|
99
|
-
bool Napi::Value::StrictEquals(const Napi::Value& other) const;
|
|
100
|
-
```
|
|
101
|
-
- `[in] other`: The `Napi::Value` object to be compared.
|
|
102
|
-
|
|
103
|
-
Returns a `bool` indicating if this `Napi::Value` strictly equals another `Napi::Value`.
|
|
104
|
-
|
|
105
|
-
### Env
|
|
106
|
-
|
|
107
|
-
```cpp
|
|
108
|
-
Napi::Env Napi::Value::Env() const;
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
Returns the `Napi::Env` environment this value is associated with.
|
|
112
|
-
|
|
113
|
-
### IsEmpty
|
|
114
|
-
|
|
115
|
-
```cpp
|
|
116
|
-
bool Napi::Value::IsEmpty() const;
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Returns a `bool` indicating if this `Napi::Value` is *empty* (uninitialized).
|
|
120
|
-
|
|
121
|
-
An empty `Napi::Value` is invalid, and most attempts to perform an operation on an empty Value will result in an exception.
|
|
122
|
-
Note an empty `Napi::Value` is distinct from JavaScript `null` or `undefined`, which are valid values.
|
|
123
|
-
|
|
124
|
-
When C++ exceptions are disabled at compile time, a method with a `Napi::Value` return type may return an empty Value to indicate a pending exception. So when not using C++ exceptions, callers should check whether this `Napi::Value` is empty before attempting to use it.
|
|
125
|
-
|
|
126
|
-
### Type
|
|
127
|
-
|
|
128
|
-
```cpp
|
|
129
|
-
napi_valuetype Napi::Value::Type() const;
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
Returns the `napi_valuetype` type of the `Napi::Value`.
|
|
133
|
-
|
|
134
|
-
### IsUndefined
|
|
135
|
-
|
|
136
|
-
```cpp
|
|
137
|
-
bool Napi::Value::IsUndefined() const;
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
Returns a `bool` indicating if this `Napi::Value` is an undefined JavaScript value.
|
|
141
|
-
|
|
142
|
-
### IsNull
|
|
143
|
-
|
|
144
|
-
```cpp
|
|
145
|
-
bool Napi::Value::IsNull() const;
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
Returns a `bool` indicating if this `Napi::Value` is a null JavaScript value.
|
|
149
|
-
|
|
150
|
-
### IsBoolean
|
|
151
|
-
|
|
152
|
-
```cpp
|
|
153
|
-
bool Napi::Value::IsBoolean() const;
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
Returns a `bool` indicating if this `Napi::Value` is a JavaScript boolean.
|
|
157
|
-
|
|
158
|
-
### IsNumber
|
|
159
|
-
|
|
160
|
-
```cpp
|
|
161
|
-
bool Napi::Value::IsNumber() const;
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
Returns a `bool` indicating if this `Napi::Value` is a JavaScript number.
|
|
165
|
-
|
|
166
|
-
### IsString
|
|
167
|
-
|
|
168
|
-
```cpp
|
|
169
|
-
bool Napi::Value::IsString() const;
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
Returns a `bool` indicating if this `Napi::Value` is a JavaScript string.
|
|
173
|
-
|
|
174
|
-
### IsSymbol
|
|
175
|
-
|
|
176
|
-
```cpp
|
|
177
|
-
bool Napi::Value::IsSymbol() const;
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
Returns a `bool` indicating if this `Napi::Value` is a JavaScript symbol.
|
|
181
|
-
|
|
182
|
-
### IsArray
|
|
183
|
-
|
|
184
|
-
```cpp
|
|
185
|
-
bool Napi::Value::IsArray() const;
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
Returns a `bool` indicating if this `Napi::Value` is a JavaScript array.
|
|
189
|
-
|
|
190
|
-
### IsArrayBuffer
|
|
191
|
-
|
|
192
|
-
```cpp
|
|
193
|
-
bool Napi::Value::IsArrayBuffer() const;
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
Returns a `bool` indicating if this `Napi::Value` is a JavaScript array buffer.
|
|
197
|
-
|
|
198
|
-
### IsTypedArray
|
|
199
|
-
|
|
200
|
-
```cpp
|
|
201
|
-
bool Napi::Value::IsTypedArray() const;
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
Returns a `bool` indicating if this `Napi::Value` is a JavaScript typed array.
|
|
205
|
-
|
|
206
|
-
### IsObject
|
|
207
|
-
|
|
208
|
-
```cpp
|
|
209
|
-
bool Napi::Value::IsObject() const;
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
Returns a `bool` indicating if this `Napi::Value` is JavaScript object.
|
|
213
|
-
|
|
214
|
-
### IsFunction
|
|
215
|
-
|
|
216
|
-
```cpp
|
|
217
|
-
bool Napi::Value::IsFunction() const;
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
Returns a `bool` indicating if this `Napi::Value` is a JavaScript function.
|
|
221
|
-
|
|
222
|
-
### IsBuffer
|
|
223
|
-
|
|
224
|
-
```cpp
|
|
225
|
-
bool Napi::Value::IsBuffer() const;
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
Returns a `bool` indicating if this `Napi::Value` is a Node buffer.
|
|
229
|
-
|
|
230
|
-
### IsDate
|
|
231
|
-
|
|
232
|
-
```cpp
|
|
233
|
-
bool Napi::Value::IsDate() const;
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
Returns a `bool` indicating if this `Napi::Value` is a JavaScript date.
|
|
237
|
-
|
|
238
|
-
### As
|
|
239
|
-
|
|
240
|
-
```cpp
|
|
241
|
-
template <typename T> T Napi::Value::As() const;
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
Casts to another type of `Napi::Value`, when the actual type is known or assumed.
|
|
245
|
-
|
|
246
|
-
This conversion does not coerce the type. Calling any methods inappropriate for the actual value type will throw `Napi::Error`.
|
|
247
|
-
|
|
248
|
-
### ToBoolean
|
|
249
|
-
|
|
250
|
-
```cpp
|
|
251
|
-
Napi::Boolean Napi::Value::ToBoolean() const;
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
Returns the `Napi::Value` coerced to a JavaScript boolean.
|
|
255
|
-
|
|
256
|
-
### ToNumber
|
|
257
|
-
|
|
258
|
-
```cpp
|
|
259
|
-
Napi::Number Napi::Value::ToNumber() const;
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
Returns the `Napi::Value` coerced to a JavaScript number.
|
|
263
|
-
|
|
264
|
-
### ToString
|
|
265
|
-
|
|
266
|
-
```cpp
|
|
267
|
-
Napi::String Napi::Value::ToString() const;
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
Returns the `Napi::Value` coerced to a JavaScript string.
|
|
271
|
-
|
|
272
|
-
### ToObject
|
|
273
|
-
|
|
274
|
-
```cpp
|
|
275
|
-
Napi::Object Napi::Value::ToObject() const;
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
Returns the `Napi::Value` coerced to a JavaScript object.
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# VersionManagement
|
|
2
|
-
|
|
3
|
-
The `Napi::VersionManagement` class contains methods that allow information
|
|
4
|
-
to be retrieved about the version of N-API and Node.js. In some cases it is
|
|
5
|
-
important to make decisions based on different versions of the system.
|
|
6
|
-
|
|
7
|
-
## Methods
|
|
8
|
-
|
|
9
|
-
### GetNapiVersion
|
|
10
|
-
|
|
11
|
-
Retrieves the highest N-API version supported by Node.js runtime.
|
|
12
|
-
|
|
13
|
-
```cpp
|
|
14
|
-
static uint32_t Napi::VersionManagement::GetNapiVersion(Env env);
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
- `[in] env`: The environment in which the API is invoked under.
|
|
18
|
-
|
|
19
|
-
Returns the highest N-API version supported by Node.js runtime.
|
|
20
|
-
|
|
21
|
-
### GetNodeVersion
|
|
22
|
-
|
|
23
|
-
Retrives information about Node.js version present on the system. All the
|
|
24
|
-
information is stored in the `napi_node_version` structrue that is defined as
|
|
25
|
-
shown below:
|
|
26
|
-
|
|
27
|
-
```cpp
|
|
28
|
-
typedef struct {
|
|
29
|
-
uint32_t major;
|
|
30
|
-
uint32_t minor;
|
|
31
|
-
uint32_t patch;
|
|
32
|
-
const char* release;
|
|
33
|
-
} napi_node_version;
|
|
34
|
-
````
|
|
35
|
-
|
|
36
|
-
```cpp
|
|
37
|
-
static const napi_node_version* Napi::VersionManagement::GetNodeVersion(Env env);
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
- `[in] env`: The environment in which the API is invoked under.
|
|
41
|
-
|
|
42
|
-
Returns the structure a pointer to the structure `napi_node_version` populated by
|
|
43
|
-
the version information of Node.js runtime.
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Working with JavaScript Values
|
|
2
|
-
|
|
3
|
-
`node-addon-api` provides a set of classes that allow to create and manage
|
|
4
|
-
JavaScript object:
|
|
5
|
-
|
|
6
|
-
- [Function](function.md)
|
|
7
|
-
- [FunctionReference](function_reference.md)
|
|
8
|
-
- [ObjectWrap](object_wrap.md)
|
|
9
|
-
- [ClassPropertyDescriptor](class_property_descriptor.md)
|
|
10
|
-
- [Buffer](buffer.md)
|
|
11
|
-
- [ArrayBuffer](array_buffer.md)
|
|
12
|
-
- [TypedArray](typed_array.md)
|
|
13
|
-
- [TypedArrayOf](typed_array_of.md)
|
|
14
|
-
- [DataView](dataview.md)
|