Source code of “Node.js: Let’s Write a Dozen of C++ Add-ons”

Cover

中文文档

This repo is the source code of book “Node.js: Let’s Write a Dozen of C++ Add-ons” which is written by XadillaX. Enjoy it!

Hint: All code in this repo were verified under macOS terminal and Node.js 6.x. Theoretically, it may run on Windows and UNIX. But I didn’t verify for these two platforms.

Download

You may download the source code from Brandview official website. Git is more recommended if you are familiar with it.

If you’re going to clone this repo, use the command line below:

$ git clone https://github.com/XadillaX/nyaa-nodejs-demo.git --recurse-submodules

Parameter --recurse-submodules allows you clone the repo with all submodules.

Due to the feature of GitHub, The ZIP file which downloaded from this page of GitHub will not contain the necessary submodules. If you want to get the source code from the method of “Downloading”, please go to the official website of Brandview.

Quick Navigation

  1. first build:「1.4.2. node-gyp」
  2. cpp entry:「2.2.2. Node.js Module Loading Principle」
  3. function template:「3.6.1. Function Template」
  4. object template:「3.6.2. Object Template」
  5. object template accessor:「3.6.3. Accessor and Interceptor of Object Template」
  6. mapped property interceptor:「3.6.3. Accessor and Interceptor of Object Template」
  7. indexed property interceptor:「3.6.3. Accessor and Interceptor of Object Template」
  8. internal field wrong:「3.6.4. Internal Field of Object Template」
  9. internal field right:「3.6.4. Internal Field of Object Template」
  10. function template inherit:「3.6.5. Inherit of Object Template」
  11. array prototype map:「3.7.6. Function」
  12. try catch:「3.8.1. Try-Catch」
  13. hello world again:「4.2.1. Hello World Again」
  14. function parameters:「4.2.2. Function Parameters」
  15. run callback:「4.2.3. Callback Function」
  16. object factory:「4.2.4. Return an Objects」
  17. function factory:「4.2.5. Return a Function」
  18. myobject:「4.3.1. JavaScript Class C++ Wrapper」
  19. at_exit_hook:「4.3.4. at_exit_hook」
  20. nan echo:「5.2.3. Come Come Go!」
  21. nan array prototype map:「5.2.4. Basic Helpers and Macros」
  22. nan set method:「5.3.3. Setting Method」
  23. nan reverse string:「5.4.3. Play with Data Object」
  24. nan object demo:「5.4.3. Play with Data Object」
  25. nan array demo:「5.4.3. Play with Data Object」
  26. nan json:「5.4.3. Play with Data Object」
  27. nan buffer:「5.4.3. Play with Data Object」
  28. nan nbodies:「5.5.3. Nan::AsyncWorker」
  29. nan dummy download:「5.5.4. Nan::AsyncProgressWorker」
  30. libuv idle:「6.1.3. Have a Taste」
  31. libuv sleep sort:「6.2.1. libuv Thread」
  32. libuv sleep sort advanced:「6.2.2. Synchronization Primitives」
  33. libuv watchdog:「6.3.2. Semi-finished Watchdog」
  34. efsw:「7.1.1. Functional Planning」
  35. efsw advanced:「7.4.2. JavaScript Code Improving」
  36. napi:「9.1.1. Write a Echo Function」

QQ Communicate Group

QQ 群

Thanks

Thank you for supporting my book!

フランドール・スカーレット

This picture from Pixiv