diff --git a/src/robotjs.cc b/src/robotjs.cc index 0d85ed1f..7afb05e2 100644 --- a/src/robotjs.cc +++ b/src/robotjs.cc @@ -19,42 +19,42 @@ using namespace v8; NAN_METHOD(moveMouse) { - NanScope(); - if (args.Length() < 2) - { - return NanThrowError("Invalid number of arguments"); - } - size_t x = args[0]->Int32Value(); - size_t y = args[1]->Int32Value(); - - MMPoint point; - point = MMPointMake(x, y); - moveMouse(point); - NanReturnValue(NanNew("1")); + NanScope(); + if (args.Length() < 2) + { + return NanThrowError("Invalid number of arguments"); + } + size_t x = args[0]->Int32Value(); + size_t y = args[1]->Int32Value(); + + MMPoint point; + point = MMPointMake(x, y); + moveMouse(point); + NanReturnValue(NanNew("1")); } NAN_METHOD(getMousePos) { - NanScope(); + NanScope(); - MMPoint pos = getMousePos(); + MMPoint pos = getMousePos(); - //Return object with .x and .y. - Local obj = NanNew(); - obj->Set(NanNew("x"), NanNew(pos.x)); - obj->Set(NanNew("y"), NanNew(pos.y)); - NanReturnValue(obj); + //Return object with .x and .y. + Local obj = NanNew(); + obj->Set(NanNew("x"), NanNew(pos.x)); + obj->Set(NanNew("y"), NanNew(pos.y)); + NanReturnValue(obj); } NAN_METHOD(mouseClick) { - NanScope(); + NanScope(); - MMMouseButton button = LEFT_BUTTON; + MMMouseButton button = LEFT_BUTTON; - clickMouse(button); + clickMouse(button); - NanReturnValue(NanNew("1")); + NanReturnValue(NanNew("1")); } /* @@ -68,48 +68,48 @@ NAN_METHOD(mouseClick) NAN_METHOD (keyTap) { - NanScope(); + NanScope(); - MMKeyFlags flags = MOD_NONE; + MMKeyFlags flags = MOD_NONE; - const char c = (*v8::String::Utf8Value(args[0]->ToString()))[0]; + const char c = (*v8::String::Utf8Value(args[0]->ToString()))[0]; - tapKey(c, flags); + tapKey(c, flags); - NanReturnValue(NanNew("1")); + NanReturnValue(NanNew("1")); } NAN_METHOD (typeString) { - NanScope(); - - char *str; - NanUtf8String string(args[0]); + NanScope(); + + char *str; + NanUtf8String string(args[0]); - str= *string; + str = *string; - typeString(str); + typeString(str); - NanReturnValue(NanNew("1")); + NanReturnValue(NanNew("1")); } void init(Handle target) { - target->Set(NanNew("moveMouse"), - NanNew(moveMouse)->GetFunction()); + target->Set(NanNew("moveMouse"), + NanNew(moveMouse)->GetFunction()); - target->Set(NanNew("getMousePos"), - NanNew(getMousePos)->GetFunction()); + target->Set(NanNew("getMousePos"), + NanNew(getMousePos)->GetFunction()); - target->Set(NanNew("mouseClick"), - NanNew(mouseClick)->GetFunction()); + target->Set(NanNew("mouseClick"), + NanNew(mouseClick)->GetFunction()); - target->Set(NanNew("keyTap"), - NanNew(keyTap)->GetFunction()); + target->Set(NanNew("keyTap"), + NanNew(keyTap)->GetFunction()); - target->Set(NanNew("typeString"), - NanNew(typeString)->GetFunction()); + target->Set(NanNew("typeString"), + NanNew(typeString)->GetFunction()); }