File tree Expand file tree Collapse file tree 4 files changed +43
-0
lines changed
Expand file tree Collapse file tree 4 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "targets" : [
3+ {
4+ "target_name" : "hello" ,
5+ "sources" : [ "hello.cc" ],
6+ "include_dirs" : [
7+ "<!(node -e \" require('nan')\" )"
8+ ]
9+ }
10+ ]
11+ }
Original file line number Diff line number Diff line change 1+ #include < nan.h>
2+
3+ using namespace v8 ;
4+
5+ NAN_METHOD (Method) {
6+ NanScope ();
7+ NanReturnValue (String::New (" world" ));
8+ }
9+
10+ void Init (Handle<Object> exports) {
11+ exports->Set (String::NewSymbol (" hello" ),
12+ FunctionTemplate::New (Method)->GetFunction ());
13+ }
14+
15+ NODE_MODULE (hello, Init)
Original file line number Diff line number Diff line change 1+ var addon = require ( './build/Release/hello' ) ;
2+
3+ console . log ( addon . hello ( ) ) ; // 'world'
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " hello_world" ,
3+ "version" : " 0.0.0" ,
4+ "description" : " Node.js Addons Example #1" ,
5+ "main" : " hello.js" ,
6+ "private" : true ,
7+ "dependencies" : {
8+ "nan" : " ~0.6.0"
9+ },
10+ "scripts" : {
11+ "test" : " node hello.js"
12+ },
13+ "gypfile" : true
14+ }
You can’t perform that action at this time.
0 commit comments