-
Notifications
You must be signed in to change notification settings - Fork 465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup documentation #335
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
doc/async_worker.md
Outdated
@@ -81,13 +81,13 @@ This method is used to execute some tasks out of the **event loop** on a libuv | |||
worker thread. Subclasses must implement this method and the method is run on | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: comma between "Instead" and "once"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
doc/async_worker.md
Outdated
@@ -140,16 +140,15 @@ operations ends. The given function is called from the main event loop thread. | |||
identifier for the kind of resource that is being provided for diagnostic | |||
information exposed by the async_hooks API. | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: `Queue` should be fully namespaced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
doc/async_worker.md
Outdated
@@ -160,31 +159,30 @@ information exposed by the async_hooks API. | |||
- `[in] resource`: Object associated with the asynchronous operation that | |||
will be passed to possible async_hooks. | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: `Queue` should be fully namespaced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
doc/async_worker.md
Outdated
``` | ||
|
||
- `[in] receiver`: The `this` object passed to the called function. | ||
- `[in] callback`: The function which will be called when an asynchronous | ||
operations ends. The given function is called from the main event loop thread. | ||
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: `Queue` should be fully namespaced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
doc/async_worker.md
Outdated
|
||
```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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: The types of the formal parameters should probably be fully namespaced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
doc/async_worker.md
Outdated
@@ -215,15 +212,15 @@ information exposed by the async_hooks API. | |||
- `[in] resource`: Object associated with the asynchronous operation that | |||
will be passed to possible async_hooks. | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: `Queue` should be fully namespaced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
doc/async_worker.md
Outdated
|
||
```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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: The types of the formal arguments should probably be namespaced as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
doc/async_worker.md
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: full namespacing for `Execute`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
doc/async_worker.md
Outdated
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 | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: full namespacing for `Execute` and `OnOK`. Same with instances below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
doc/string.md
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these 2 might not be right as I don't expect std::Napi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok just fixed!
@mhdawson I'm working on |
@mhdawson @gabrielschulhof Ended to fix reported problems |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were a few grammatical issues, which I ignored as I was not very sure.
doc/async_worker.md
Outdated
`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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
completes
doc/async_worker.md
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Napi::AsyncWorker::OnOK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also Napi::AsyncWorker::Execute
doc/async_worker.md
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Napi::AsyncWorker::OnOK
doc/async_worker.md
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant "that will"
doc/async_worker.md
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You only need to?
doc/handle_scope.md
Outdated
``` | ||
|
||
Returns the Napi:Env associated with the HandleScope. | ||
Returns the `Napi:Env` associated with the `Napi::HandleScope`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Napi::Env
doc/promises.md
Outdated
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last Promise need not be code-quoted, right?
doc/property_descriptor.md
Outdated
@@ -1,6 +1,6 @@ | |||
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... (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 <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]>
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 <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]>
* Cleaning the documentation. * Remove comments about things under development. * Include Napi namespace consistently. PR-URL: nodejs/node-addon-api#335 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]>
* Cleaning the documentation. * Remove comments about things under development. * Include Napi namespace consistently. PR-URL: nodejs/node-addon-api#335 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]>
* Cleaning the documentation. * Remove comments about things under development. * Include Napi namespace consistently. PR-URL: nodejs/node-addon-api#335 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]>
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.