summaryrefslogtreecommitdiff
path: root/node_modules/node-addon-api/doc/callbackinfo.md
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-03 02:37:42 -0700
committer8cy <[email protected]>2020-04-03 02:37:42 -0700
commit60867fb030bae582082340ead7dbc7efdc2f5398 (patch)
tree4c6a7356351be2e4914e15c4703172597c45656e /node_modules/node-addon-api/doc/callbackinfo.md
parentcommenting (diff)
downloads5nical-60867fb030bae582082340ead7dbc7efdc2f5398.tar.xz
s5nical-60867fb030bae582082340ead7dbc7efdc2f5398.zip
2020/04/03, 02:34, v1.2.0
Diffstat (limited to 'node_modules/node-addon-api/doc/callbackinfo.md')
-rw-r--r--node_modules/node-addon-api/doc/callbackinfo.md97
1 files changed, 97 insertions, 0 deletions
diff --git a/node_modules/node-addon-api/doc/callbackinfo.md b/node_modules/node-addon-api/doc/callbackinfo.md
new file mode 100644
index 0000000..0bf4e1a
--- /dev/null
+++ b/node_modules/node-addon-api/doc/callbackinfo.md
@@ -0,0 +1,97 @@
+# CallbackInfo
+
+The object representing the components of the JavaScript request being made.
+
+The `Napi::CallbackInfo` object is usually created and passed by the Node.js runtime or node-addon-api infrastructure.
+
+The `Napi::CallbackInfo` object contains the arguments passed by the caller. The number of arguments is returned by the `Length` method. Each individual argument can be accessed using the `operator[]` method.
+
+The `SetData` and `Data` methods are used to set and retrieve the data pointer contained in the `Napi::CallbackInfo` object.
+
+## Methods
+
+### Constructor
+
+```cpp
+Napi::CallbackInfo::CallbackInfo(napi_env env, napi_callback_info info);
+```
+
+- `[in] env`: The `napi_env` environment in which to construct the `Napi::CallbackInfo` object.
+- `[in] info`: The `napi_callback_info` data structure from which to construct the `Napi::CallbackInfo` object.
+
+### Env
+
+```cpp
+Napi::Env Napi::CallbackInfo::Env() const;
+```
+
+Returns the `Env` object in which the request is being made.
+
+### NewTarget
+
+```cpp
+Napi::Value Napi::CallbackInfo::NewTarget() const;
+```
+
+Returns the `new.target` value of the constructor call. If the function that was invoked (and for which the `Napi::NCallbackInfo` was passed) is not a constructor call, a call to `IsEmpty()` on the returned value returns true.
+
+### IsConstructCall
+
+```cpp
+bool Napi::CallbackInfo::IsConstructCall() const;
+```
+
+Returns a `bool` indicating if the function that was invoked (and for which the `Napi::CallbackInfo` was passed) is a constructor call.
+
+### Length
+
+```cpp
+size_t Napi::CallbackInfo::Length() const;
+```
+
+Returns the number of arguments passed in the `Napi::CallbackInfo` object.
+
+### operator []
+
+```cpp
+const Napi::Value operator [](size_t index) const;
+```
+
+- `[in] index`: The zero-based index of the requested argument.
+
+Returns a `Napi::Value` object containing the requested argument.
+
+### This
+
+```cpp
+Napi::Value Napi::CallbackInfo::This() const;
+```
+
+Returns the JavaScript `this` value for the call
+
+### Data
+
+```cpp
+void* Napi::CallbackInfo::Data() const;
+```
+
+Returns the data pointer for the callback.
+
+### SetData
+
+```cpp
+void Napi::CallbackInfo::SetData(void* data);
+```
+
+- `[in] data`: The new data pointer to associate with this `Napi::CallbackInfo` object.
+
+Returns `void`.
+
+### Not documented here
+
+```cpp
+Napi::CallbackInfo::~CallbackInfo();
+// Disallow copying to prevent multiple free of _dynamicArgs
+Napi::CallbackInfo::CallbackInfo(CallbackInfo const &) = delete;
+void Napi::CallbackInfo::operator=(CallbackInfo const &) = delete;
+```