Coder Social home page Coder Social logo

1995parham / napi101 Goto Github PK

View Code? Open in Web Editor NEW
11.0 5.0 0.0 22 KB

Let's learn N-API (Native API of NodeJS 8.7.0)

License: GNU General Public License v3.0

Python 2.39% C 85.84% JavaScript 11.77%
napi nodejs tutorial nodejs-addon nodejs-napi

napi101's Introduction

Napi101

Introduction

The N-API is a new and better way for creating native module for NodeJS. In this repository I tried to create some simple and functional example of N-API. N-API is in early stage so it may have inconsistent documentation so I create example based on thing that I can do correctly.

Issues

  1. N-API Callback Return

Examples

Hello

This module register hello function on hello module. hello function prints Hello world on console with printf and return 1373 from native function into javascript caller.

hello.js
src
 |
 \ hello.c

Bye

This module register byeSync and byeASync functions on bye module. ByeSync function waits 1s and do some work and ByeASync waits 1s asynchronously and do some work. Both functions return 1373 at the end into javascript caller.

bye.js
src
 |
 \ bye.c

Installation

npm install
# have fun with your native module.
node --napi-modules index.js

napi101's People

Contributors

1995parham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.