Skip to content

Commit 3f3dc7b

Browse files
committed
updated jub3i's code to work with new nan, fixes #153
1 parent 91cd9ce commit 3f3dc7b

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/robotjs.cc

+7-10
Original file line numberDiff line numberDiff line change
@@ -683,25 +683,22 @@ NAN_METHOD(getScreenSize)
683683

684684
NAN_METHOD(getXDisplayName)
685685
{
686-
NanScope();
687-
688686
#if defined(USE_X11)
689-
NanReturnValue(NanNew<String>(getXDisplay()));
687+
const char* display = getXDisplay();
688+
info.GetReturnValue().Set(Nan::New<String>(display).ToLocalChecked());
690689
#else
691-
NanThrowError("getXDisplayName is only supported on Linux");
690+
Nan::ThrowError("getXDisplayName is only supported on Linux");
692691
#endif
693692
}
694693

695694
NAN_METHOD(setXDisplayName)
696695
{
697-
NanScope();
698-
699696
#if defined(USE_X11)
700-
NanUtf8String name(args[0]);
701-
setXDisplay(*name);
702-
NanReturnValue(NanNew("1"));
697+
Nan::Utf8String string(info[0]);
698+
setXDisplay(*string);
699+
info.GetReturnValue().Set(Nan::New(1));
703700
#else
704-
NanThrowError("setXDisplayName is only supported on Linux");
701+
Nan::ThrowError("setXDisplayName is only supported on Linux");
705702
#endif
706703
}
707704

0 commit comments

Comments
 (0)