-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathhello_world.hpp
More file actions
43 lines (35 loc) · 1.13 KB
/
hello_world.hpp
File metadata and controls
43 lines (35 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#pragma once
#pragma GCC diagnostic push
// #pragma GCC diagnostic ignored "-Wunused-parameter"
// #pragma GCC diagnostic ignored "-Wshadow"
#include <nan.h>
#pragma GCC diagnostic pop
/**
* HelloWorld class
* This is in a header file so we can access it across other .cpp files
* if necessary
*/
class HelloWorld: public Nan::ObjectWrap
{
public:
// initializer
static NAN_MODULE_INIT(Init);
// methods required for the constructor
static NAN_METHOD(New);
static Nan::Persistent<v8::Function> &constructor();
// wave, custom sync method
static NAN_METHOD(wave);
// shout, custom async method
static NAN_METHOD(shout);
static void AsyncShout(uv_work_t* req);
static void AfterShout(uv_work_t* req);
// constructor
// This includes a Default Argument
// If a paramter value is passed in, it takes priority over the default arg
// HelloWorld --> class
HelloWorld(std::string name="hello");
private:
// member variable
// specific to each instance of the class
std::string name_;
};