Cleanup documentation#335
Cleanup documentation#335NickNaso wants to merge 9 commits intonodejs:masterfrom NickNaso:cleanup-documentation
Conversation
Remove comments about things under development Include Napi namespace consistently
|
Hi everyone I ended to clean up the documentation removing the unnecessary working progress comments and adding the Napi namespace. Please review this work so we can complete the steps to release the first complete version of documentation for |
gabrielschulhof
left a comment
There was a problem hiding this comment.
There are some more places where we should be namespacing. Maybe this needs a systematic search for "&$96;" with a handy "Napi::" in the clipboard. That way, only the class names need to be typed in by hand.
| a thread other than that running the main event loop. As the method is not | ||
| running on the main event loop, it must avoid calling any methods from node-addon-api | ||
| or running any code that might invoke JavaScript. Instead once this method is | ||
| or running any code that might invoke JavaScript. Instead once this method is |
There was a problem hiding this comment.
nit: comma between "Instead" and "once"
|
|
||
| Returns an AsyncWork instance which can later be queued for execution by calling | ||
| Returns a `Napi::AsyncWork` instance which can later be queued for execution by calling | ||
| `Queue`. |
There was a problem hiding this comment.
nit: `Queue` should be fully namespaced.
|
|
||
| Returns an AsyncWork instance which can later be queued for execution by calling | ||
| Returns a `Napi::AsyncWork` instance which can later be queued for execution by calling | ||
| `Queue`. |
There was a problem hiding this comment.
nit: `Queue` should be fully namespaced.
|
|
||
| Returns an AsyncWork instance which can later be queued for execution by calling | ||
| Returns a `Napi::AsyncWork` instance which can later be queued for execution by calling | ||
| `Queue`. |
There was a problem hiding this comment.
nit: `Queue` should be fully namespaced.
|
|
||
| ```cpp | ||
| explicit AsyncWorker(const Object& receiver, const Function& callback,const char* resource_name); | ||
| explicit Napi::AsyncWorker(const Object& receiver, const Function& callback,const char* resource_name); |
There was a problem hiding this comment.
nit: The types of the formal parameters should probably be fully namespaced.
|
|
||
| Returns an AsyncWork instance which can later be queued for execution by calling | ||
| Returns a `Napi::AsyncWork` instance which can later be queued for execution by calling | ||
| `Queue`. |
There was a problem hiding this comment.
nit: `Queue` should be fully namespaced.
|
|
||
| ```cpp | ||
| explicit AsyncWorker(const Object& receiver, const Function& callback, const char* resource_name, const Object& resource); | ||
| explicit Napi::AsyncWorker(const Object& receiver, const Function& callback, const char* resource_name, const Object& resource); |
There was a problem hiding this comment.
nit: The types of the formal arguments should probably be namespaced as well.
| The first step to use the `AsyncWorker` class is to create a new class that inherit | ||
| from it and implement the `Execute` abstract method. Typically input to your | ||
| The first step to use the `Napi::AsyncWorker` class is to create a new class that | ||
| inherits from it and implement the `Execute` abstract method. Typically input to your |
There was a problem hiding this comment.
nit: full namespacing for `Execute`
| worker will be saved within class' fields generally passed in through its | ||
| constructor. | ||
|
|
||
| When the `Execute` method completes without errors the `OnOK` function callback |
There was a problem hiding this comment.
nit: full namespacing for `Execute` and `OnOK`. Same with instances below.
| String::New(napi_env env, const char* value); | ||
| String::New(napi_env env, const char16_t* value); | ||
| Napi::String::New(napi_env env, const std::Napi::string& value); | ||
| Napi::String::New(napi_env env, const std::u16Napi::string& value); |
There was a problem hiding this comment.
I think these 2 might not be right as I don't expect std::Napi
|
@mhdawson I'm working on |
|
@mhdawson @gabrielschulhof Ended to fix reported problems |
thefourtheye
left a comment
There was a problem hiding this comment.
There were a few grammatical issues, which I ignored as I was not very sure.
| `OnError` methods are complete the AsyncWorker instance is destructed. | ||
| Once created, execution is requested by calling `Napi::AsyncWorker::Queue`. When | ||
| a thread is available for execution the `Napi::AsyncWorker::Execute` method will | ||
| be invoked. Once `Napi::AsyncWorker::Execute` complets either |
| an error message will cause the `OnError` method to be invoked instead of `OnOK` | ||
| once the `Execute` method completes. | ||
| an error message will cause the `Napi::AsyncWorker::OnError` method to be | ||
| invoked instead of `OnOK` once the `Napi::AsyncWorker::OnError::Execute` method |
| on the `Execute` method is done the `OnOk` method is called and the results return | ||
| back to JavaScript invoking the stored callback with its associated environment. | ||
| callback that the `Napi::AsyncWorker` base class will store persistently. When | ||
| the work on the `Execute` method is done the `OnOk` method is called and the |
| only create a new instance and pass to its constructor the callback you want to | ||
| execute when your asynchronous task ends and other data you need for your | ||
| computation. Once created the only other action you have to do is to call the | ||
| `Napi::AsyncWorker::Queue` method that will that will queue the created worker |
| your asynchronous task ends and other data you need for your computation. Once created the | ||
| only other action you have to do is to call the `Queue` method that will that will | ||
| queue the created worker for execution. | ||
| Using the implementation of a `Napi::AsyncWorker` is straight forward. You need |
| ``` | ||
|
|
||
| Returns the Napi:Env associated with the HandleScope. | ||
| Returns the `Napi:Env` associated with the `Napi::HandleScope`. |
| # Promise | ||
|
|
||
| The Promise class, along with its Promise::Deferred class, implement the ability to create, resolve, and reject Promise objects. | ||
| The `Napi::Promise` class, along with its `Napi::Promise::Deferred` class, implement the ability to create, resolve, and reject `Promise` objects. |
There was a problem hiding this comment.
The last Promise need not be code-quoted, right?
| # Property Descriptor | ||
|
|
||
| An [Object](object.md) can be assigned properites via its [DefineProperty](object.md#defineproperty) and [DefineProperties](object.md#defineproperties) function, which take PropertyDescrptor(s) as their parameters. The PropertyDescriptor can contain either values or functions, which are then assigned to the Object. Note that a single instance of a PropertyDescriptor class can only contain either one value, or at most two functions. PropertyDescriptors can only be created through the class methods [Accessor](#accessor), [Function](#function), or [Value](#value), each of which return a new static instance of a PropertyDescriptor. | ||
| A [`Napi::Object`](object.md) can be assigned properites via its [`DefineProperty`](object.md#defineproperty) and [`DefineProperties`](object.md#defineproperties) function, which take PropertyDescrptor(s) as their parameters. The `Napi::PropertyDescriptor` can contain either values or functions, which are then assigned to the `Napi::Object`. Note that a single instance of a `Napi::PropertyDescriptor` class can only contain either one value, or at most two functions. PropertyDescriptors can only be created through the class methods [`Accessor`](#accessor), [`Function`](#function), or [`Value`](#value), each of which return a new static instance of a `Napi::PropertyDescriptor`. |
There was a problem hiding this comment.
... (object.md#defineproperties) functions && which take PropertyDescriptor(s)
* Cleaning the documentation. * Remove comments about things under development. * Include Napi namespace consistently. PR-URL: #335 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
|
Landed as fc11c94. Thanks for all of the hard work! |
* Cleaning the documentation. * Remove comments about things under development. * Include Napi namespace consistently. PR-URL: nodejs/node-addon-api#335 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
* Cleaning the documentation. * Remove comments about things under development. * Include Napi namespace consistently. PR-URL: nodejs/node-addon-api#335 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
* Cleaning the documentation. * Remove comments about things under development. * Include Napi namespace consistently. PR-URL: nodejs/node-addon-api#335 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
* Cleaning the documentation. * Remove comments about things under development. * Include Napi namespace consistently. PR-URL: nodejs/node-addon-api#335 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Start cleaning up documentation like reported here : nodejs/abi-stable-node#280 (comment)
I need to do another pass to complete the work, but if anyone want start the review it could be great.