@contrast/agent 4.5.0 → 4.7.0
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/bin/VERSION +1 -1
- package/bin/linux/contrast-service +0 -0
- package/bin/mac/contrast-service +0 -0
- package/bin/windows/contrast-service.exe +0 -0
- package/lib/assess/membrane/source-membrane.js +4 -18
- package/lib/assess/policy/propagators.json +11 -21
- package/lib/assess/policy/rules.json +5 -0
- package/lib/assess/policy/signatures.json +15 -0
- package/lib/assess/propagators/dustjs/escape-html.js +22 -0
- package/lib/assess/propagators/dustjs/escape-js.js +22 -0
- package/lib/assess/propagators/encode-uri/encode-uri-component.js +22 -0
- package/lib/assess/propagators/encode-uri/encode-uri.js +22 -0
- package/lib/assess/propagators/index.js +0 -2
- package/lib/assess/propagators/joi/values.js +26 -11
- package/lib/assess/propagators/mustache/escape.js +22 -0
- package/lib/assess/propagators/path/common.js +155 -46
- package/lib/assess/propagators/path/join.js +5 -1
- package/lib/assess/propagators/path/normalize.js +1 -2
- package/lib/assess/propagators/path/resolve.js +11 -2
- package/lib/assess/propagators/template-escape.js +84 -0
- package/lib/assess/propagators/templates.js +2 -3
- package/lib/assess/sinks/dustjs-linkedin-xss.js +131 -0
- package/lib/core/arch-components/dynamodb.js +1 -2
- package/lib/core/arch-components/dynamodbv3.js +44 -0
- package/lib/core/arch-components/index.js +1 -0
- package/lib/core/arch-components/rethinkdb.js +53 -0
- package/lib/core/async-storage/hooks/bluebird.js +20 -0
- package/lib/core/config/options.js +2 -1
- package/lib/core/stacktrace.js +3 -4
- package/lib/feature-set.js +2 -1
- package/lib/hooks/frameworks/base.js +8 -2
- package/lib/hooks/frameworks/http.js +23 -16
- package/lib/hooks/frameworks/http2.js +73 -0
- package/lib/hooks/frameworks/index.js +8 -3
- package/lib/hooks/http.js +112 -128
- package/lib/hooks/patcher.js +69 -48
- package/lib/hooks/require.js +16 -22
- package/lib/instrumentation.js +0 -3
- package/lib/protect/rules/cmd-injection-command-backdoors/backdoor-detector.js +3 -3
- package/lib/protect/rules/signatures/reflected-xss/helpers/function-call.js +1 -1
- package/lib/protect/rules/xss/helpers/function-call.js +1 -1
- package/lib/util/clean-stack.js +1 -1
- package/lib/util/clean-string/brackets.js +3 -3
- package/lib/util/ip-analyzer.js +1 -1
- package/lib/util/some.js +27 -0
- package/lib/util/source-map.js +1 -1
- package/lib/util/xml-analyzer/external-entity-finder.js +1 -1
- package/package.json +14 -16
- package/lib/hooks/frameworks/https.js +0 -42
- package/node_modules/bindings/LICENSE.md +0 -22
- package/node_modules/bindings/README.md +0 -98
- package/node_modules/bindings/bindings.js +0 -221
- package/node_modules/bindings/package.json +0 -32
- package/node_modules/file-uri-to-path/.npmignore +0 -1
- package/node_modules/file-uri-to-path/.travis.yml +0 -30
- package/node_modules/file-uri-to-path/History.md +0 -21
- package/node_modules/file-uri-to-path/LICENSE +0 -20
- package/node_modules/file-uri-to-path/README.md +0 -74
- package/node_modules/file-uri-to-path/index.d.ts +0 -2
- package/node_modules/file-uri-to-path/index.js +0 -66
- package/node_modules/file-uri-to-path/package.json +0 -36
- package/node_modules/file-uri-to-path/test/test.js +0 -24
- package/node_modules/file-uri-to-path/test/tests.json +0 -13
- package/node_modules/glossy/LICENSE +0 -19
- package/node_modules/glossy/README.md +0 -129
- package/node_modules/glossy/index.js +0 -12
- package/node_modules/glossy/lib/glossy/parse.js +0 -520
- package/node_modules/glossy/lib/glossy/produce.js +0 -459
- package/node_modules/glossy/package.json +0 -47
- package/node_modules/glossy/test/decide.js +0 -7
- package/node_modules/glossy/test/decode_pri.js +0 -24
- package/node_modules/glossy/test/parse_3164.js +0 -104
- package/node_modules/glossy/test/parse_5424.js +0 -106
- package/node_modules/glossy/test/parse_5848.js +0 -40
- package/node_modules/glossy/test/parse_8601.js +0 -14
- package/node_modules/glossy/test/parse_rfc3339.js +0 -9
- package/node_modules/glossy/test/produce.js +0 -162
- package/node_modules/glossy/test/runner.js +0 -40
- package/node_modules/glossy/test/structure_data.js +0 -24
- package/node_modules/nan/CHANGELOG.md +0 -537
- package/node_modules/nan/LICENSE.md +0 -13
- package/node_modules/nan/README.md +0 -455
- package/node_modules/nan/doc/asyncworker.md +0 -146
- package/node_modules/nan/doc/buffers.md +0 -54
- package/node_modules/nan/doc/callback.md +0 -76
- package/node_modules/nan/doc/converters.md +0 -41
- package/node_modules/nan/doc/errors.md +0 -226
- package/node_modules/nan/doc/json.md +0 -62
- package/node_modules/nan/doc/maybe_types.md +0 -583
- package/node_modules/nan/doc/methods.md +0 -664
- package/node_modules/nan/doc/new.md +0 -147
- package/node_modules/nan/doc/node_misc.md +0 -123
- package/node_modules/nan/doc/object_wrappers.md +0 -263
- package/node_modules/nan/doc/persistent.md +0 -296
- package/node_modules/nan/doc/scopes.md +0 -73
- package/node_modules/nan/doc/script.md +0 -38
- package/node_modules/nan/doc/string_bytes.md +0 -62
- package/node_modules/nan/doc/v8_internals.md +0 -199
- package/node_modules/nan/doc/v8_misc.md +0 -85
- package/node_modules/nan/include_dirs.js +0 -1
- package/node_modules/nan/nan.h +0 -2898
- package/node_modules/nan/nan_callbacks.h +0 -88
- package/node_modules/nan/nan_callbacks_12_inl.h +0 -514
- package/node_modules/nan/nan_callbacks_pre_12_inl.h +0 -520
- package/node_modules/nan/nan_converters.h +0 -72
- package/node_modules/nan/nan_converters_43_inl.h +0 -68
- package/node_modules/nan/nan_converters_pre_43_inl.h +0 -42
- package/node_modules/nan/nan_define_own_property_helper.h +0 -29
- package/node_modules/nan/nan_implementation_12_inl.h +0 -430
- package/node_modules/nan/nan_implementation_pre_12_inl.h +0 -263
- package/node_modules/nan/nan_json.h +0 -166
- package/node_modules/nan/nan_maybe_43_inl.h +0 -356
- package/node_modules/nan/nan_maybe_pre_43_inl.h +0 -268
- package/node_modules/nan/nan_new.h +0 -340
- package/node_modules/nan/nan_object_wrap.h +0 -156
- package/node_modules/nan/nan_persistent_12_inl.h +0 -132
- package/node_modules/nan/nan_persistent_pre_12_inl.h +0 -242
- package/node_modules/nan/nan_private.h +0 -73
- package/node_modules/nan/nan_string_bytes.h +0 -305
- package/node_modules/nan/nan_typedarray_contents.h +0 -96
- package/node_modules/nan/nan_weak.h +0 -437
- package/node_modules/nan/package.json +0 -41
- package/node_modules/nan/tools/1to2.js +0 -412
- package/node_modules/nan/tools/README.md +0 -14
- package/node_modules/nan/tools/package.json +0 -19
- package/node_modules/unix-dgram/LICENSE +0 -13
- package/node_modules/unix-dgram/README.md +0 -107
- package/node_modules/unix-dgram/binding.gyp +0 -20
- package/node_modules/unix-dgram/build/Makefile +0 -324
- package/node_modules/unix-dgram/build/Release/.deps/Release/obj.target/unix_dgram/src/unix_dgram.o.d +0 -58
- package/node_modules/unix-dgram/build/Release/.deps/Release/obj.target/unix_dgram.node.d +0 -1
- package/node_modules/unix-dgram/build/Release/.deps/Release/unix_dgram.node.d +0 -1
- package/node_modules/unix-dgram/build/Release/obj.target/unix_dgram/src/unix_dgram.o +0 -0
- package/node_modules/unix-dgram/build/Release/obj.target/unix_dgram.node +0 -0
- package/node_modules/unix-dgram/build/Release/unix_dgram.node +0 -0
- package/node_modules/unix-dgram/build/binding.Makefile +0 -6
- package/node_modules/unix-dgram/build/config.gypi +0 -213
- package/node_modules/unix-dgram/build/unix_dgram.target.mk +0 -159
- package/node_modules/unix-dgram/lib/unix_dgram.js +0 -168
- package/node_modules/unix-dgram/package.json +0 -36
- package/node_modules/unix-dgram/src/unix_dgram.cc +0 -404
- package/node_modules/unix-dgram/src/win_dummy.cc +0 -7
- package/node_modules/unix-dgram/test/test-connect-callback.js +0 -68
- package/node_modules/unix-dgram/test/test-connect.js +0 -53
- package/node_modules/unix-dgram/test/test-dgram-unix.js +0 -58
- package/node_modules/unix-dgram/test/test-send-error.js +0 -26
- package/node_modules/winston-syslog/.eslintrc +0 -7
- package/node_modules/winston-syslog/.travis.yml +0 -14
- package/node_modules/winston-syslog/CHANGELOG.md +0 -9
- package/node_modules/winston-syslog/LICENSE +0 -20
- package/node_modules/winston-syslog/README.md +0 -135
- package/node_modules/winston-syslog/lib/utils.js +0 -26
- package/node_modules/winston-syslog/lib/winston-syslog.js +0 -385
- package/node_modules/winston-syslog/package.json +0 -56
- package/node_modules/winston-syslog/test/format-test.js +0 -122
- package/node_modules/winston-syslog/test/syslog-test.js +0 -95
- package/node_modules/winston-syslog/test/unix-connect-test.js +0 -133
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
## Persistent references
|
|
2
|
-
|
|
3
|
-
An object reference that is independent of any `HandleScope` is a _persistent_ reference. Where a `Local` handle only lives as long as the `HandleScope` in which it was allocated, a `Persistent` handle remains valid until it is explicitly disposed.
|
|
4
|
-
|
|
5
|
-
Due to the evolution of the V8 API, it is necessary for NAN to provide a wrapper implementation of the `Persistent` classes to supply compatibility across the V8 versions supported.
|
|
6
|
-
|
|
7
|
-
- <a href="#api_nan_persistent_base"><b><code>Nan::PersistentBase & v8::PersistentBase</code></b></a>
|
|
8
|
-
- <a href="#api_nan_non_copyable_persistent_traits"><b><code>Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits</code></b></a>
|
|
9
|
-
- <a href="#api_nan_copyable_persistent_traits"><b><code>Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits</code></b></a>
|
|
10
|
-
- <a href="#api_nan_persistent"><b><code>Nan::Persistent</code></b></a>
|
|
11
|
-
- <a href="#api_nan_global"><b><code>Nan::Global</code></b></a>
|
|
12
|
-
- <a href="#api_nan_weak_callback_info"><b><code>Nan::WeakCallbackInfo</code></b></a>
|
|
13
|
-
- <a href="#api_nan_weak_callback_type"><b><code>Nan::WeakCallbackType</code></b></a>
|
|
14
|
-
|
|
15
|
-
Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles).
|
|
16
|
-
|
|
17
|
-
<a name="api_nan_persistent_base"></a>
|
|
18
|
-
### Nan::PersistentBase & v8::PersistentBase
|
|
19
|
-
|
|
20
|
-
A persistent handle contains a reference to a storage cell in V8 which holds an object value and which is updated by the garbage collector whenever the object is moved. A new storage cell can be created using the constructor or `Nan::PersistentBase::Reset()`. Existing handles can be disposed using an argument-less `Nan::PersistentBase::Reset()`.
|
|
21
|
-
|
|
22
|
-
Definition:
|
|
23
|
-
|
|
24
|
-
_(note: this is implemented as `Nan::PersistentBase` for older versions of V8 and the native `v8::PersistentBase` is used for newer versions of V8)_
|
|
25
|
-
|
|
26
|
-
```c++
|
|
27
|
-
template<typename T> class PersistentBase {
|
|
28
|
-
public:
|
|
29
|
-
/**
|
|
30
|
-
* If non-empty, destroy the underlying storage cell
|
|
31
|
-
*/
|
|
32
|
-
void Reset();
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* If non-empty, destroy the underlying storage cell and create a new one with
|
|
36
|
-
* the contents of another if it is also non-empty
|
|
37
|
-
*/
|
|
38
|
-
template<typename S> void Reset(const v8::Local<S> &other);
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* If non-empty, destroy the underlying storage cell and create a new one with
|
|
42
|
-
* the contents of another if it is also non-empty
|
|
43
|
-
*/
|
|
44
|
-
template<typename S> void Reset(const PersistentBase<S> &other);
|
|
45
|
-
|
|
46
|
-
/** Returns true if the handle is empty. */
|
|
47
|
-
bool IsEmpty() const;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* If non-empty, destroy the underlying storage cell
|
|
51
|
-
* IsEmpty() will return true after this call.
|
|
52
|
-
*/
|
|
53
|
-
void Empty();
|
|
54
|
-
|
|
55
|
-
template<typename S> bool operator==(const PersistentBase<S> &that);
|
|
56
|
-
|
|
57
|
-
template<typename S> bool operator==(const v8::Local<S> &that);
|
|
58
|
-
|
|
59
|
-
template<typename S> bool operator!=(const PersistentBase<S> &that);
|
|
60
|
-
|
|
61
|
-
template<typename S> bool operator!=(const v8::Local<S> &that);
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Install a finalization callback on this object.
|
|
65
|
-
* NOTE: There is no guarantee as to *when* or even *if* the callback is
|
|
66
|
-
* invoked. The invocation is performed solely on a best effort basis.
|
|
67
|
-
* As always, GC-based finalization should *not* be relied upon for any
|
|
68
|
-
* critical form of resource management! At the moment you can either
|
|
69
|
-
* specify a parameter for the callback or the location of two internal
|
|
70
|
-
* fields in the dying object.
|
|
71
|
-
*/
|
|
72
|
-
template<typename P>
|
|
73
|
-
void SetWeak(P *parameter,
|
|
74
|
-
typename WeakCallbackInfo<P>::Callback callback,
|
|
75
|
-
WeakCallbackType type);
|
|
76
|
-
|
|
77
|
-
void ClearWeak();
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Marks the reference to this object independent. Garbage collector is free
|
|
81
|
-
* to ignore any object groups containing this object. Weak callback for an
|
|
82
|
-
* independent handle should not assume that it will be preceded by a global
|
|
83
|
-
* GC prologue callback or followed by a global GC epilogue callback.
|
|
84
|
-
*/
|
|
85
|
-
void MarkIndependent() const;
|
|
86
|
-
|
|
87
|
-
bool IsIndependent() const;
|
|
88
|
-
|
|
89
|
-
/** Checks if the handle holds the only reference to an object. */
|
|
90
|
-
bool IsNearDeath() const;
|
|
91
|
-
|
|
92
|
-
/** Returns true if the handle's reference is weak. */
|
|
93
|
-
bool IsWeak() const
|
|
94
|
-
};
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
See the V8 documentation for [`PersistentBase`](https://v8docs.nodesource.com/node-8.16/d4/dca/classv8_1_1_persistent_base.html) for further information.
|
|
98
|
-
|
|
99
|
-
**Tip:** To get a `v8::Local` reference to the original object back from a `PersistentBase` or `Persistent` object:
|
|
100
|
-
|
|
101
|
-
```c++
|
|
102
|
-
v8::Local<v8::Object> object = Nan::New(persistent);
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
<a name="api_nan_non_copyable_persistent_traits"></a>
|
|
106
|
-
### Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits
|
|
107
|
-
|
|
108
|
-
Default traits for `Nan::Persistent`. This class does not allow use of the a copy constructor or assignment operator. At present `kResetInDestructor` is not set, but that will change in a future version.
|
|
109
|
-
|
|
110
|
-
Definition:
|
|
111
|
-
|
|
112
|
-
_(note: this is implemented as `Nan::NonCopyablePersistentTraits` for older versions of V8 and the native `v8::NonCopyablePersistentTraits` is used for newer versions of V8)_
|
|
113
|
-
|
|
114
|
-
```c++
|
|
115
|
-
template<typename T> class NonCopyablePersistentTraits {
|
|
116
|
-
public:
|
|
117
|
-
typedef Persistent<T, NonCopyablePersistentTraits<T> > NonCopyablePersistent;
|
|
118
|
-
|
|
119
|
-
static const bool kResetInDestructor = false;
|
|
120
|
-
|
|
121
|
-
template<typename S, typename M>
|
|
122
|
-
static void Copy(const Persistent<S, M> &source,
|
|
123
|
-
NonCopyablePersistent *dest);
|
|
124
|
-
|
|
125
|
-
template<typename O> static void Uncompilable();
|
|
126
|
-
};
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
See the V8 documentation for [`NonCopyablePersistentTraits`](https://v8docs.nodesource.com/node-8.16/de/d73/classv8_1_1_non_copyable_persistent_traits.html) for further information.
|
|
130
|
-
|
|
131
|
-
<a name="api_nan_copyable_persistent_traits"></a>
|
|
132
|
-
### Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits
|
|
133
|
-
|
|
134
|
-
A helper class of traits to allow copying and assignment of `Persistent`. This will clone the contents of storage cell, but not any of the flags, etc..
|
|
135
|
-
|
|
136
|
-
Definition:
|
|
137
|
-
|
|
138
|
-
_(note: this is implemented as `Nan::CopyablePersistentTraits` for older versions of V8 and the native `v8::NonCopyablePersistentTraits` is used for newer versions of V8)_
|
|
139
|
-
|
|
140
|
-
```c++
|
|
141
|
-
template<typename T>
|
|
142
|
-
class CopyablePersistentTraits {
|
|
143
|
-
public:
|
|
144
|
-
typedef Persistent<T, CopyablePersistentTraits<T> > CopyablePersistent;
|
|
145
|
-
|
|
146
|
-
static const bool kResetInDestructor = true;
|
|
147
|
-
|
|
148
|
-
template<typename S, typename M>
|
|
149
|
-
static void Copy(const Persistent<S, M> &source,
|
|
150
|
-
CopyablePersistent *dest);
|
|
151
|
-
};
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
See the V8 documentation for [`CopyablePersistentTraits`](https://v8docs.nodesource.com/node-8.16/da/d5c/structv8_1_1_copyable_persistent_traits.html) for further information.
|
|
155
|
-
|
|
156
|
-
<a name="api_nan_persistent"></a>
|
|
157
|
-
### Nan::Persistent
|
|
158
|
-
|
|
159
|
-
A type of `PersistentBase` which allows copy and assignment. Copy, assignment and destructor behavior is controlled by the traits class `M`.
|
|
160
|
-
|
|
161
|
-
Definition:
|
|
162
|
-
|
|
163
|
-
```c++
|
|
164
|
-
template<typename T, typename M = NonCopyablePersistentTraits<T> >
|
|
165
|
-
class Persistent;
|
|
166
|
-
|
|
167
|
-
template<typename T, typename M> class Persistent : public PersistentBase<T> {
|
|
168
|
-
public:
|
|
169
|
-
/**
|
|
170
|
-
* A Persistent with no storage cell.
|
|
171
|
-
*/
|
|
172
|
-
Persistent();
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Construct a Persistent from a v8::Local. When the v8::Local is non-empty, a
|
|
176
|
-
* new storage cell is created pointing to the same object, and no flags are
|
|
177
|
-
* set.
|
|
178
|
-
*/
|
|
179
|
-
template<typename S> Persistent(v8::Local<S> that);
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Construct a Persistent from a Persistent. When the Persistent is non-empty,
|
|
183
|
-
* a new storage cell is created pointing to the same object, and no flags are
|
|
184
|
-
* set.
|
|
185
|
-
*/
|
|
186
|
-
Persistent(const Persistent &that);
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* The copy constructors and assignment operator create a Persistent exactly
|
|
190
|
-
* as the Persistent constructor, but the Copy function from the traits class
|
|
191
|
-
* is called, allowing the setting of flags based on the copied Persistent.
|
|
192
|
-
*/
|
|
193
|
-
Persistent &operator=(const Persistent &that);
|
|
194
|
-
|
|
195
|
-
template <typename S, typename M2>
|
|
196
|
-
Persistent &operator=(const Persistent<S, M2> &that);
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* The destructor will dispose the Persistent based on the kResetInDestructor
|
|
200
|
-
* flags in the traits class. Since not calling dispose can result in a
|
|
201
|
-
* memory leak, it is recommended to always set this flag.
|
|
202
|
-
*/
|
|
203
|
-
~Persistent();
|
|
204
|
-
};
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
See the V8 documentation for [`Persistent`](https://v8docs.nodesource.com/node-8.16/d2/d78/classv8_1_1_persistent.html) for further information.
|
|
208
|
-
|
|
209
|
-
<a name="api_nan_global"></a>
|
|
210
|
-
### Nan::Global
|
|
211
|
-
|
|
212
|
-
A type of `PersistentBase` which has move semantics.
|
|
213
|
-
|
|
214
|
-
```c++
|
|
215
|
-
template<typename T> class Global : public PersistentBase<T> {
|
|
216
|
-
public:
|
|
217
|
-
/**
|
|
218
|
-
* A Global with no storage cell.
|
|
219
|
-
*/
|
|
220
|
-
Global();
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Construct a Global from a v8::Local. When the v8::Local is non-empty, a new
|
|
224
|
-
* storage cell is created pointing to the same object, and no flags are set.
|
|
225
|
-
*/
|
|
226
|
-
template<typename S> Global(v8::Local<S> that);
|
|
227
|
-
/**
|
|
228
|
-
* Construct a Global from a PersistentBase. When the Persistent is non-empty,
|
|
229
|
-
* a new storage cell is created pointing to the same object, and no flags are
|
|
230
|
-
* set.
|
|
231
|
-
*/
|
|
232
|
-
template<typename S> Global(const PersistentBase<S> &that);
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Pass allows returning globals from functions, etc.
|
|
236
|
-
*/
|
|
237
|
-
Global Pass();
|
|
238
|
-
};
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
See the V8 documentation for [`Global`](https://v8docs.nodesource.com/node-8.16/d5/d40/classv8_1_1_global.html) for further information.
|
|
242
|
-
|
|
243
|
-
<a name="api_nan_weak_callback_info"></a>
|
|
244
|
-
### Nan::WeakCallbackInfo
|
|
245
|
-
|
|
246
|
-
`Nan::WeakCallbackInfo` is used as an argument when setting a persistent reference as weak. You may need to free any external resources attached to the object. It is a mirror of `v8:WeakCallbackInfo` as found in newer versions of V8.
|
|
247
|
-
|
|
248
|
-
Definition:
|
|
249
|
-
|
|
250
|
-
```c++
|
|
251
|
-
template<typename T> class WeakCallbackInfo {
|
|
252
|
-
public:
|
|
253
|
-
typedef void (*Callback)(const WeakCallbackInfo<T>& data);
|
|
254
|
-
|
|
255
|
-
v8::Isolate *GetIsolate() const;
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Get the parameter that was associated with the weak handle.
|
|
259
|
-
*/
|
|
260
|
-
T *GetParameter() const;
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Get pointer from internal field, index can be 0 or 1.
|
|
264
|
-
*/
|
|
265
|
-
void *GetInternalField(int index) const;
|
|
266
|
-
};
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
Example usage:
|
|
270
|
-
|
|
271
|
-
```c++
|
|
272
|
-
void weakCallback(const WeakCallbackInfo<int> &data) {
|
|
273
|
-
int *parameter = data.GetParameter();
|
|
274
|
-
delete parameter;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
Persistent<v8::Object> obj;
|
|
278
|
-
int *data = new int(0);
|
|
279
|
-
obj.SetWeak(data, callback, WeakCallbackType::kParameter);
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
See the V8 documentation for [`WeakCallbackInfo`](https://v8docs.nodesource.com/node-8.16/d8/d06/classv8_1_1_weak_callback_info.html) for further information.
|
|
283
|
-
|
|
284
|
-
<a name="api_nan_weak_callback_type"></a>
|
|
285
|
-
### Nan::WeakCallbackType
|
|
286
|
-
|
|
287
|
-
Represents the type of a weak callback.
|
|
288
|
-
A weak callback of type `kParameter` makes the supplied parameter to `Nan::PersistentBase::SetWeak` available through `WeakCallbackInfo::GetParameter`.
|
|
289
|
-
A weak callback of type `kInternalFields` uses up to two internal fields at indices 0 and 1 on the `Nan::PersistentBase<v8::Object>` being made weak.
|
|
290
|
-
Note that only `v8::Object`s and derivatives can have internal fields.
|
|
291
|
-
|
|
292
|
-
Definition:
|
|
293
|
-
|
|
294
|
-
```c++
|
|
295
|
-
enum class WeakCallbackType { kParameter, kInternalFields };
|
|
296
|
-
```
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
## Scopes
|
|
2
|
-
|
|
3
|
-
A _local handle_ is a pointer to an object. All V8 objects are accessed using handles, they are necessary because of the way the V8 garbage collector works.
|
|
4
|
-
|
|
5
|
-
A handle scope can be thought of as a container for any number of handles. When you've finished with your handles, instead of deleting each one individually you can simply delete their scope.
|
|
6
|
-
|
|
7
|
-
The creation of `HandleScope` objects is different across the supported versions of V8. Therefore, NAN provides its own implementations that can be used safely across these.
|
|
8
|
-
|
|
9
|
-
- <a href="#api_nan_handle_scope"><b><code>Nan::HandleScope</code></b></a>
|
|
10
|
-
- <a href="#api_nan_escapable_handle_scope"><b><code>Nan::EscapableHandleScope</code></b></a>
|
|
11
|
-
|
|
12
|
-
Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://github.com/v8/v8/wiki/Embedder%27s%20Guide#handles-and-garbage-collection).
|
|
13
|
-
|
|
14
|
-
<a name="api_nan_handle_scope"></a>
|
|
15
|
-
### Nan::HandleScope
|
|
16
|
-
|
|
17
|
-
A simple wrapper around [`v8::HandleScope`](https://v8docs.nodesource.com/node-8.16/d3/d95/classv8_1_1_handle_scope.html).
|
|
18
|
-
|
|
19
|
-
Definition:
|
|
20
|
-
|
|
21
|
-
```c++
|
|
22
|
-
class Nan::HandleScope {
|
|
23
|
-
public:
|
|
24
|
-
Nan::HandleScope();
|
|
25
|
-
static int NumberOfHandles();
|
|
26
|
-
};
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Allocate a new `Nan::HandleScope` whenever you are creating new V8 JavaScript objects. Note that an implicit `HandleScope` is created for you on JavaScript-accessible methods so you do not need to insert one yourself.
|
|
30
|
-
|
|
31
|
-
Example:
|
|
32
|
-
|
|
33
|
-
```c++
|
|
34
|
-
// new object is created, it needs a new scope:
|
|
35
|
-
void Pointless() {
|
|
36
|
-
Nan::HandleScope scope;
|
|
37
|
-
v8::Local<v8::Object> obj = Nan::New<v8::Object>();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// JavaScript-accessible method already has a HandleScope
|
|
41
|
-
NAN_METHOD(Pointless2) {
|
|
42
|
-
v8::Local<v8::Object> obj = Nan::New<v8::Object>();
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
<a name="api_nan_escapable_handle_scope"></a>
|
|
47
|
-
### Nan::EscapableHandleScope
|
|
48
|
-
|
|
49
|
-
Similar to [`Nan::HandleScope`](#api_nan_handle_scope) but should be used in cases where a function needs to return a V8 JavaScript type that has been created within it.
|
|
50
|
-
|
|
51
|
-
Definition:
|
|
52
|
-
|
|
53
|
-
```c++
|
|
54
|
-
class Nan::EscapableHandleScope {
|
|
55
|
-
public:
|
|
56
|
-
Nan::EscapableHandleScope();
|
|
57
|
-
static int NumberOfHandles();
|
|
58
|
-
template<typename T> v8::Local<T> Escape(v8::Local<T> value);
|
|
59
|
-
}
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Use `Escape(value)` to return the object.
|
|
63
|
-
|
|
64
|
-
Example:
|
|
65
|
-
|
|
66
|
-
```c++
|
|
67
|
-
v8::Local<v8::Object> EmptyObj() {
|
|
68
|
-
Nan::EscapableHandleScope scope;
|
|
69
|
-
v8::Local<v8::Object> obj = Nan::New<v8::Object>();
|
|
70
|
-
return scope.Escape(obj);
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
## Script
|
|
2
|
-
|
|
3
|
-
NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8.
|
|
4
|
-
|
|
5
|
-
- <a href="#api_nan_compile_script"><b><code>Nan::CompileScript()</code></b></a>
|
|
6
|
-
- <a href="#api_nan_run_script"><b><code>Nan::RunScript()</code></b></a>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<a name="api_nan_compile_script"></a>
|
|
10
|
-
### Nan::CompileScript()
|
|
11
|
-
|
|
12
|
-
A wrapper around [`v8::ScriptCompiler::Compile()`](https://v8docs.nodesource.com/node-8.16/da/da5/classv8_1_1_script_compiler.html#a93f5072a0db55d881b969e9fc98e564b).
|
|
13
|
-
|
|
14
|
-
Note that `Nan::BoundScript` is an alias for `v8::Script`.
|
|
15
|
-
|
|
16
|
-
Signature:
|
|
17
|
-
|
|
18
|
-
```c++
|
|
19
|
-
Nan::MaybeLocal<Nan::BoundScript> Nan::CompileScript(
|
|
20
|
-
v8::Local<v8::String> s,
|
|
21
|
-
const v8::ScriptOrigin& origin);
|
|
22
|
-
Nan::MaybeLocal<Nan::BoundScript> Nan::CompileScript(v8::Local<v8::String> s);
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<a name="api_nan_run_script"></a>
|
|
27
|
-
### Nan::RunScript()
|
|
28
|
-
|
|
29
|
-
Calls `script->Run()` or `script->BindToCurrentContext()->Run(Nan::GetCurrentContext())`.
|
|
30
|
-
|
|
31
|
-
Note that `Nan::BoundScript` is an alias for `v8::Script` and `Nan::UnboundScript` is an alias for `v8::UnboundScript` where available and `v8::Script` on older versions of V8.
|
|
32
|
-
|
|
33
|
-
Signature:
|
|
34
|
-
|
|
35
|
-
```c++
|
|
36
|
-
Nan::MaybeLocal<v8::Value> Nan::RunScript(v8::Local<Nan::UnboundScript> script)
|
|
37
|
-
Nan::MaybeLocal<v8::Value> Nan::RunScript(v8::Local<Nan::BoundScript> script)
|
|
38
|
-
```
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
## Strings & Bytes
|
|
2
|
-
|
|
3
|
-
Miscellaneous string & byte encoding and decoding functionality provided for compatibility across supported versions of V8 and Node. Implemented by NAN to ensure that all encoding types are supported, even for older versions of Node where they are missing.
|
|
4
|
-
|
|
5
|
-
- <a href="#api_nan_encoding"><b><code>Nan::Encoding</code></b></a>
|
|
6
|
-
- <a href="#api_nan_encode"><b><code>Nan::Encode()</code></b></a>
|
|
7
|
-
- <a href="#api_nan_decode_bytes"><b><code>Nan::DecodeBytes()</code></b></a>
|
|
8
|
-
- <a href="#api_nan_decode_write"><b><code>Nan::DecodeWrite()</code></b></a>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<a name="api_nan_encoding"></a>
|
|
12
|
-
### Nan::Encoding
|
|
13
|
-
|
|
14
|
-
An enum representing the supported encoding types. A copy of `node::encoding` that is consistent across versions of Node.
|
|
15
|
-
|
|
16
|
-
Definition:
|
|
17
|
-
|
|
18
|
-
```c++
|
|
19
|
-
enum Nan::Encoding { ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER }
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<a name="api_nan_encode"></a>
|
|
24
|
-
### Nan::Encode()
|
|
25
|
-
|
|
26
|
-
A wrapper around `node::Encode()` that provides a consistent implementation across supported versions of Node.
|
|
27
|
-
|
|
28
|
-
Signature:
|
|
29
|
-
|
|
30
|
-
```c++
|
|
31
|
-
v8::Local<v8::Value> Nan::Encode(const void *buf,
|
|
32
|
-
size_t len,
|
|
33
|
-
enum Nan::Encoding encoding = BINARY);
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
<a name="api_nan_decode_bytes"></a>
|
|
38
|
-
### Nan::DecodeBytes()
|
|
39
|
-
|
|
40
|
-
A wrapper around `node::DecodeBytes()` that provides a consistent implementation across supported versions of Node.
|
|
41
|
-
|
|
42
|
-
Signature:
|
|
43
|
-
|
|
44
|
-
```c++
|
|
45
|
-
ssize_t Nan::DecodeBytes(v8::Local<v8::Value> val,
|
|
46
|
-
enum Nan::Encoding encoding = BINARY);
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<a name="api_nan_decode_write"></a>
|
|
51
|
-
### Nan::DecodeWrite()
|
|
52
|
-
|
|
53
|
-
A wrapper around `node::DecodeWrite()` that provides a consistent implementation across supported versions of Node.
|
|
54
|
-
|
|
55
|
-
Signature:
|
|
56
|
-
|
|
57
|
-
```c++
|
|
58
|
-
ssize_t Nan::DecodeWrite(char *buf,
|
|
59
|
-
size_t len,
|
|
60
|
-
v8::Local<v8::Value> val,
|
|
61
|
-
enum Nan::Encoding encoding = BINARY);
|
|
62
|
-
```
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
## V8 internals
|
|
2
|
-
|
|
3
|
-
The hooks to access V8 internals—including GC and statistics—are different across the supported versions of V8, therefore NAN provides its own hooks that call the appropriate V8 methods.
|
|
4
|
-
|
|
5
|
-
- <a href="#api_nan_gc_callback"><b><code>NAN_GC_CALLBACK()</code></b></a>
|
|
6
|
-
- <a href="#api_nan_add_gc_epilogue_callback"><b><code>Nan::AddGCEpilogueCallback()</code></b></a>
|
|
7
|
-
- <a href="#api_nan_remove_gc_epilogue_callback"><b><code>Nan::RemoveGCEpilogueCallback()</code></b></a>
|
|
8
|
-
- <a href="#api_nan_add_gc_prologue_callback"><b><code>Nan::AddGCPrologueCallback()</code></b></a>
|
|
9
|
-
- <a href="#api_nan_remove_gc_prologue_callback"><b><code>Nan::RemoveGCPrologueCallback()</code></b></a>
|
|
10
|
-
- <a href="#api_nan_get_heap_statistics"><b><code>Nan::GetHeapStatistics()</code></b></a>
|
|
11
|
-
- <a href="#api_nan_set_counter_function"><b><code>Nan::SetCounterFunction()</code></b></a>
|
|
12
|
-
- <a href="#api_nan_set_create_histogram_function"><b><code>Nan::SetCreateHistogramFunction()</code></b></a>
|
|
13
|
-
- <a href="#api_nan_set_add_histogram_sample_function"><b><code>Nan::SetAddHistogramSampleFunction()</code></b></a>
|
|
14
|
-
- <a href="#api_nan_idle_notification"><b><code>Nan::IdleNotification()</code></b></a>
|
|
15
|
-
- <a href="#api_nan_low_memory_notification"><b><code>Nan::LowMemoryNotification()</code></b></a>
|
|
16
|
-
- <a href="#api_nan_context_disposed_notification"><b><code>Nan::ContextDisposedNotification()</code></b></a>
|
|
17
|
-
- <a href="#api_nan_get_internal_field_pointer"><b><code>Nan::GetInternalFieldPointer()</code></b></a>
|
|
18
|
-
- <a href="#api_nan_set_internal_field_pointer"><b><code>Nan::SetInternalFieldPointer()</code></b></a>
|
|
19
|
-
- <a href="#api_nan_adjust_external_memory"><b><code>Nan::AdjustExternalMemory()</code></b></a>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<a name="api_nan_gc_callback"></a>
|
|
23
|
-
### NAN_GC_CALLBACK(callbackname)
|
|
24
|
-
|
|
25
|
-
Use `NAN_GC_CALLBACK` to declare your callbacks for `Nan::AddGCPrologueCallback()` and `Nan::AddGCEpilogueCallback()`. Your new method receives the arguments `v8::GCType type` and `v8::GCCallbackFlags flags`.
|
|
26
|
-
|
|
27
|
-
```c++
|
|
28
|
-
static Nan::Persistent<Function> callback;
|
|
29
|
-
|
|
30
|
-
NAN_GC_CALLBACK(gcPrologueCallback) {
|
|
31
|
-
v8::Local<Value> argv[] = { Nan::New("prologue").ToLocalChecked() };
|
|
32
|
-
Nan::MakeCallback(Nan::GetCurrentContext()->Global(), Nan::New(callback), 1, argv);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
NAN_METHOD(Hook) {
|
|
36
|
-
callback.Reset(To<Function>(args[0]).ToLocalChecked());
|
|
37
|
-
Nan::AddGCPrologueCallback(gcPrologueCallback);
|
|
38
|
-
info.GetReturnValue().Set(info.Holder());
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
<a name="api_nan_add_gc_epilogue_callback"></a>
|
|
43
|
-
### Nan::AddGCEpilogueCallback()
|
|
44
|
-
|
|
45
|
-
Signature:
|
|
46
|
-
|
|
47
|
-
```c++
|
|
48
|
-
void Nan::AddGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback, v8::GCType gc_type_filter = v8::kGCTypeAll)
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Calls V8's [`AddGCEpilogueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a580f976e4290cead62c2fc4dd396be3e).
|
|
52
|
-
|
|
53
|
-
<a name="api_nan_remove_gc_epilogue_callback"></a>
|
|
54
|
-
### Nan::RemoveGCEpilogueCallback()
|
|
55
|
-
|
|
56
|
-
Signature:
|
|
57
|
-
|
|
58
|
-
```c++
|
|
59
|
-
void Nan::RemoveGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback)
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Calls V8's [`RemoveGCEpilogueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#adca9294555a3908e9f23c7bb0f0f284c).
|
|
63
|
-
|
|
64
|
-
<a name="api_nan_add_gc_prologue_callback"></a>
|
|
65
|
-
### Nan::AddGCPrologueCallback()
|
|
66
|
-
|
|
67
|
-
Signature:
|
|
68
|
-
|
|
69
|
-
```c++
|
|
70
|
-
void Nan::AddGCPrologueCallback(v8::Isolate::GCPrologueCallback, v8::GCType gc_type_filter callback)
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Calls V8's [`AddGCPrologueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a6dbef303603ebdb03da6998794ea05b8).
|
|
74
|
-
|
|
75
|
-
<a name="api_nan_remove_gc_prologue_callback"></a>
|
|
76
|
-
### Nan::RemoveGCPrologueCallback()
|
|
77
|
-
|
|
78
|
-
Signature:
|
|
79
|
-
|
|
80
|
-
```c++
|
|
81
|
-
void Nan::RemoveGCPrologueCallback(v8::Isolate::GCPrologueCallback callback)
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Calls V8's [`RemoveGCPrologueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a5f72c7cda21415ce062bbe5c58abe09e).
|
|
85
|
-
|
|
86
|
-
<a name="api_nan_get_heap_statistics"></a>
|
|
87
|
-
### Nan::GetHeapStatistics()
|
|
88
|
-
|
|
89
|
-
Signature:
|
|
90
|
-
|
|
91
|
-
```c++
|
|
92
|
-
void Nan::GetHeapStatistics(v8::HeapStatistics *heap_statistics)
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
Calls V8's [`GetHeapStatistics()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a5593ac74687b713095c38987e5950b34).
|
|
96
|
-
|
|
97
|
-
<a name="api_nan_set_counter_function"></a>
|
|
98
|
-
### Nan::SetCounterFunction()
|
|
99
|
-
|
|
100
|
-
Signature:
|
|
101
|
-
|
|
102
|
-
```c++
|
|
103
|
-
void Nan::SetCounterFunction(v8::CounterLookupCallback cb)
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
Calls V8's [`SetCounterFunction()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a045d7754e62fa0ec72ae6c259b29af94).
|
|
107
|
-
|
|
108
|
-
<a name="api_nan_set_create_histogram_function"></a>
|
|
109
|
-
### Nan::SetCreateHistogramFunction()
|
|
110
|
-
|
|
111
|
-
Signature:
|
|
112
|
-
|
|
113
|
-
```c++
|
|
114
|
-
void Nan::SetCreateHistogramFunction(v8::CreateHistogramCallback cb)
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
Calls V8's [`SetCreateHistogramFunction()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a542d67e85089cb3f92aadf032f99e732).
|
|
118
|
-
|
|
119
|
-
<a name="api_nan_set_add_histogram_sample_function"></a>
|
|
120
|
-
### Nan::SetAddHistogramSampleFunction()
|
|
121
|
-
|
|
122
|
-
Signature:
|
|
123
|
-
|
|
124
|
-
```c++
|
|
125
|
-
void Nan::SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb)
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
Calls V8's [`SetAddHistogramSampleFunction()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#aeb420b690bc2c216882d6fdd00ddd3ea).
|
|
129
|
-
|
|
130
|
-
<a name="api_nan_idle_notification"></a>
|
|
131
|
-
### Nan::IdleNotification()
|
|
132
|
-
|
|
133
|
-
Signature:
|
|
134
|
-
|
|
135
|
-
```c++
|
|
136
|
-
bool Nan::IdleNotification(int idle_time_in_ms)
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
Calls V8's [`IdleNotification()` or `IdleNotificationDeadline()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#ad6a2a02657f5425ad460060652a5a118) depending on V8 version.
|
|
140
|
-
|
|
141
|
-
<a name="api_nan_low_memory_notification"></a>
|
|
142
|
-
### Nan::LowMemoryNotification()
|
|
143
|
-
|
|
144
|
-
Signature:
|
|
145
|
-
|
|
146
|
-
```c++
|
|
147
|
-
void Nan::LowMemoryNotification()
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
Calls V8's [`LowMemoryNotification()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a24647f61d6b41f69668094bdcd6ea91f).
|
|
151
|
-
|
|
152
|
-
<a name="api_nan_context_disposed_notification"></a>
|
|
153
|
-
### Nan::ContextDisposedNotification()
|
|
154
|
-
|
|
155
|
-
Signature:
|
|
156
|
-
|
|
157
|
-
```c++
|
|
158
|
-
void Nan::ContextDisposedNotification()
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
Calls V8's [`ContextDisposedNotification()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#ad7f5dc559866343fe6cd8db1f134d48b).
|
|
162
|
-
|
|
163
|
-
<a name="api_nan_get_internal_field_pointer"></a>
|
|
164
|
-
### Nan::GetInternalFieldPointer()
|
|
165
|
-
|
|
166
|
-
Gets a pointer to the internal field with at `index` from a V8 `Object` handle.
|
|
167
|
-
|
|
168
|
-
Signature:
|
|
169
|
-
|
|
170
|
-
```c++
|
|
171
|
-
void* Nan::GetInternalFieldPointer(v8::Local<v8::Object> object, int index)
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
Calls the Object's [`GetAlignedPointerFromInternalField()` or `GetPointerFromInternalField()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a580ea84afb26c005d6762eeb9e3c308f) depending on the version of V8.
|
|
175
|
-
|
|
176
|
-
<a name="api_nan_set_internal_field_pointer"></a>
|
|
177
|
-
### Nan::SetInternalFieldPointer()
|
|
178
|
-
|
|
179
|
-
Sets the value of the internal field at `index` on a V8 `Object` handle.
|
|
180
|
-
|
|
181
|
-
Signature:
|
|
182
|
-
|
|
183
|
-
```c++
|
|
184
|
-
void Nan::SetInternalFieldPointer(v8::Local<v8::Object> object, int index, void* value)
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
Calls the Object's [`SetAlignedPointerInInternalField()` or `SetPointerInInternalField()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ab3c57184263cf29963ef0017bec82281) depending on the version of V8.
|
|
188
|
-
|
|
189
|
-
<a name="api_nan_adjust_external_memory"></a>
|
|
190
|
-
### Nan::AdjustExternalMemory()
|
|
191
|
-
|
|
192
|
-
Signature:
|
|
193
|
-
|
|
194
|
-
```c++
|
|
195
|
-
int Nan::AdjustExternalMemory(int bytesChange)
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
Calls V8's [`AdjustAmountOfExternalAllocatedMemory()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#ae1a59cac60409d3922582c4af675473e).
|
|
199
|
-
|