summaryrefslogtreecommitdiff
path: root/node_modules/node-addon-api/doc/promises.md
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-03 02:48:28 -0700
committer8cy <[email protected]>2020-04-03 02:48:28 -0700
commitf9159ea2d994e14180fb02ab562f0119513e67cf (patch)
tree09d14cdf05456567156738b681379d4bccd64e5c /node_modules/node-addon-api/doc/promises.md
parent2020/04/03, 02:42, V1.2.1 (diff)
downloads5nical-f9159ea2d994e14180fb02ab562f0119513e67cf.tar.xz
s5nical-f9159ea2d994e14180fb02ab562f0119513e67cf.zip
2020/04/03, 02:47, V1.2.2
Diffstat (limited to 'node_modules/node-addon-api/doc/promises.md')
-rw-r--r--node_modules/node-addon-api/doc/promises.md74
1 files changed, 0 insertions, 74 deletions
diff --git a/node_modules/node-addon-api/doc/promises.md b/node_modules/node-addon-api/doc/promises.md
deleted file mode 100644
index 6252900..0000000
--- a/node_modules/node-addon-api/doc/promises.md
+++ /dev/null
@@ -1,74 +0,0 @@
-# Promise
-
-The `Napi::Promise` class, along with its `Napi::Promise::Deferred` class, implement the ability to create, resolve, and reject Promise objects.
-
-The basic approach is to create a `Napi::Promise::Deferred` object and return to your caller the value returned by the `Napi::Promise::Deferred::Promise` method. For example:
-
-```cpp
-Napi::Value YourFunction(const Napi::CallbackInfo& info) {
- // your code goes here...
- Napi::Promise::Deferred deferred = Napi::Promise::Deferred::New(info.Env());
- // deferred needs to survive this call...
- return deferred.Promise();
-}
-```
-
-Later, when the asynchronous process completes, call either the `Resolve` or `Reject` method on the `Napi::Promise::Deferred` object created earlier:
-
-```cpp
- deferred.Resolve(String::New(info.Env(), "OK"));
-```
-
-## Promise::Deferred Methods
-
-### Factory Method
-
-```cpp
-static Napi::Promise::Deferred Napi::Promise::Deferred::New(napi_env env);
-```
-
-* `[in] env`: The `napi_env` environment in which to create the `Napi::Promise::Deferred` object.
-
-### Constructor
-
-```cpp
-Napi::Promise::Deferred(napi_env env);
-```
-
-* `[in] env`: The `napi_env` environment in which to construct the `Napi::Promise::Deferred` object.
-
-### Env
-
-```cpp
-Napi::Env Napi::Promise::Deferred::Env() const;
-```
-
-Returns the Env environment this `Napi::Promise::Deferred` object is associated with.
-
-### Promise
-
-```cpp
-Napi::Promise Napi::Promise::Deferred::Promise() const;
-```
-
-Returns the `Napi::Promise` object held by the `Napi::Promise::Deferred` object.
-
-### Resolve
-
-```cpp
-void Napi::Promise::Deferred::Resolve(napi_value value) const;
-```
-
-Resolves the `Napi::Promise` object held by the `Napi::Promise::Deferred` object.
-
-* `[in] value`: The N-API primitive value with which to resolve the `Napi::Promise`.
-
-### Reject
-
-```cpp
-void Napi::Promise::Deferred::Reject(napi_value value) const;
-```
-
-Rejects the Promise object held by the `Napi::Promise::Deferred` object.
-
-* `[in] value`: The N-API primitive value with which to reject the `Napi::Promise`.