Skip to content
This repository has been archived by the owner on Jul 25, 2019. It is now read-only.
Kenny Yuan edited this page Sep 11, 2016 · 4 revisions

What is WIDL-NAN

WIDL-NAN enables developers to write a Node.js addon with least knowledge to Node.js addon development.

With this WIDL-NAN tool, developers can work out a Node.js addon using pure C++ to work in problem domain, with least knowledge of v8, Node.js & NAN. To achieve that, developers are supposed to define the API exposed in Node.js environment in Web IDL language.

Typical Use Case

  • If you're a C++ developer, and you want your C++ API to be exposed in Node.js environment.
  • Or if you're a Node.js developer, and you have to write something in C++ because it can't be done in pure JavaScript.
  • If you're not familiar with v8 or Nan
  • If you don't want to write many lines in NAN notation for every single API in your Node.js addon

Then you might benefit from this WIDL-NAN tool.

Getting Started with WIDL-NAN

To use WIDL-NAN tool, you'll need to do the following

  1. Define your Node.js interface in Web IDL Language, written into a file (or multiple files)
  2. Run WIDL-NAN on that file (or multiple files)
  3. Run node-gyp to build the Node.js addon
  4. Now you'll get a Node.js addon with all the API you defined, but without any real functionalities. It's time you modify the generated skeleton of implementation code, adding the functionalities.

For complete spec and/or examples of Web IDL language, please follow this link.

You can use WIDL-NAN as a command line tool, or use WIDL-NAN as a Node.js module

For the usage of node-gyp (a Node.js C++ addon build tool), please find it here.

WIDL-NAN Feature List

WIDL-NAN tool only supports a practical subset of WebIDL language. A complete list of supported features can be found in Feature List