| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
The clang-format checking tools is designed to check changed lines of code compared to given git-refs.
The tool requires Python 3 to run git-clang-format. It first tries the executable specified by the PYTHON environment variable, when set. On Windows it then tries the Python launcher (py -3), followed by python3 and python. On other platforms it tries python3 and then python.
The migration tool is designed to reduce repetitive work in the migration process. However, the script is not aiming to convert every thing for you. There are usually some small fixes and major reconstruction required.
To run the conversion script, first make sure you have the latest node-addon-api in your node_modules directory.
npm install node-addon-api
Then run the script passing your project directory
node ./node_modules/node-addon-api/tools/conversion.js ./
After finish, recompile and debug things that are missed by the script.
Here is the list of things that can be fixed easily.
The implementation of Napi::ObjectWrap is significantly different from NAN's. Napi::ObjectWrap takes a pointer to the wrapped object and creates a reference to the wrapped object inside ObjectWrap constructor. Napi::ObjectWrap also associates wrapped object's instance methods to Javascript module instead of static methods like NAN.
So if you use Nan::ObjectWrap in your module, you will need to execute the following steps.
[ClassName](const Napi::CallbackInfo& info);
and define it as
[ClassName]::[ClassName](const Napi::CallbackInfo& info) : Napi::ObjectWrap<[ClassName]>(info){
...
}
This way, the Napi::ObjectWrap constructor will be invoked after the object has been instantiated and Napi::ObjectWrap can use the this pointer to create a reference to the wrapped object.
Napi::FunctionReference constructor;
void [ClassName]::Init(Napi::Env env, Napi::Object exports, Napi::Object module) {
Napi::HandleScope scope(env);
Napi::Function ctor = DefineClass(env, "Canvas", {
InstanceMethod<&[ClassName]::Func1>("Func1"),
InstanceMethod<&[ClassName]::Func2>("Func2"),
InstanceAccessor<&[ClassName]::ValueGetter>("Value"),
StaticMethod<&[ClassName]::StaticMethod>("MethodName"),
InstanceValue("Value", Napi::[Type]::New(env, value)),
});
constructor = Napi::Persistent(ctor);
constructor .SuppressDestruct();
exports.Set("[ClassName]", ctor);
}
If you still find issues after following this guide, please leave us an issue describing your problem and we will try to resolve it.
| Back | FazBrowse Home | New Git URL |