Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make global delays configurable. #75

Merged
merged 1 commit into from
Aug 11, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/robotjs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,20 @@ NAN_METHOD(mouseToggle)
NanReturnValue(NanNew("1"));
}

NAN_METHOD(setMouseDelay)
{
NanScope();

if (args.Length() != 1)
{
return NanThrowError("Invalid number of arguments.");
}

mouseDelay = args[0]->Int32Value();

NanReturnValue(NanNew("1"));
}

/*
_ __ _ _
| |/ /___ _ _| |__ ___ __ _ _ __ __| |
Expand Down Expand Up @@ -492,6 +506,20 @@ NAN_METHOD(typeString)
NanReturnValue(NanNew("1"));
}

NAN_METHOD(setKeyboardDelay)
{
NanScope();

if (args.Length() != 1)
{
return NanThrowError("Invalid number of arguments.");
}

keyboardDelay = args[0]->Int32Value();

NanReturnValue(NanNew("1"));
}

/*
____
/ ___| ___ _ __ ___ ___ _ __
Expand Down Expand Up @@ -560,6 +588,9 @@ void init(Handle<Object> target)
target->Set(NanNew<String>("mouseToggle"),
NanNew<FunctionTemplate>(mouseToggle)->GetFunction());

target->Set(NanNew<String>("setMouseDelay"),
NanNew<FunctionTemplate>(setMouseDelay)->GetFunction());

target->Set(NanNew<String>("keyTap"),
NanNew<FunctionTemplate>(keyTap)->GetFunction());

Expand All @@ -569,6 +600,9 @@ void init(Handle<Object> target)
target->Set(NanNew<String>("typeString"),
NanNew<FunctionTemplate>(typeString)->GetFunction());

target->Set(NanNew<String>("setKeyboardDelay"),
NanNew<FunctionTemplate>(setKeyboardDelay)->GetFunction());

target->Set(NanNew<String>("getPixelColor"),
NanNew<FunctionTemplate>(getPixelColor)->GetFunction());

Expand Down