Skip to content

Commit 65ef462

Browse files
authored
Merge pull request #76 from taskworld/add-node@12-support
Add support for node@12
2 parents 207bd5d + 39a886a commit 65ef462

File tree

4 files changed

+493
-170
lines changed

4 files changed

+493
-170
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ node_js:
1010
- 6
1111
- 8
1212
- 10
13+
- 12
1314

1415
env:
1516
global:

appveyor.yml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ environment:
55
- nodejs_version: "6"
66
- nodejs_version: "8"
77
- nodejs_version: "10"
8+
- nodejs_version: "12"
89

910
branches:
1011
only:

src/NSFW.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,9 @@ NAN_MODULE_INIT(NSFW::Init) {
126126
SetPrototypeMethod(tpl, "start", Start);
127127
SetPrototypeMethod(tpl, "stop", Stop);
128128

129-
constructor.Reset(tpl->GetFunction());
130-
Set(target, New<v8::String>("NSFW").ToLocalChecked(), tpl->GetFunction());
129+
v8::Local<v8::Context> context = Nan::GetCurrentContext();
130+
constructor.Reset(tpl->GetFunction(context).ToLocalChecked());
131+
Set(target, New<v8::String>("NSFW").ToLocalChecked(), tpl->GetFunction(context).ToLocalChecked());
131132
}
132133

133134
NAN_METHOD(NSFW::JSNew) {
@@ -154,8 +155,9 @@ NAN_METHOD(NSFW::JSNew) {
154155
return ThrowError("Fourth argument of constructor must be a callback.");
155156
}
156157

157-
uint32_t debounceMS = info[0]->Uint32Value();
158-
v8::String::Utf8Value utf8Value(info[1]->ToString());
158+
v8::Local<v8::Context> context = Nan::GetCurrentContext();
159+
uint32_t debounceMS = info[0]->Uint32Value(context).FromJust();
160+
Nan::Utf8String utf8Value(Nan::To<v8::String>(info[1]).ToLocalChecked());
159161
std::string path = std::string(*utf8Value);
160162
Callback *eventCallback = new Callback(info[2].As<v8::Function>());
161163
Callback *errorCallback = new Callback(info[3].As<v8::Function>());

0 commit comments

Comments
 (0)