Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Add support for node@12 #11

Merged
merged 2 commits into from
Nov 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist: trusty
sudo: true

os:
Expand All @@ -10,6 +11,7 @@ node_js:
- 6
- 8
- 10
- 12

env:
global:
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ environment:
- nodejs_version: "6"
- nodejs_version: "8"
- nodejs_version: "10"
- nodejs_version: "12"

branches:
only:
Expand Down
10 changes: 6 additions & 4 deletions src/NSFW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,9 @@ NAN_MODULE_INIT(NSFW::Init) {
SetPrototypeMethod(tpl, "start", Start);
SetPrototypeMethod(tpl, "stop", Stop);

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

NAN_METHOD(NSFW::JSNew) {
Expand All @@ -174,8 +175,9 @@ NAN_METHOD(NSFW::JSNew) {
return ThrowError("Fourth argument of constructor must be a callback.");
}

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