We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e981548 commit 2fc100aCopy full SHA for 2fc100a
src/robotjs.cc
@@ -71,6 +71,32 @@ NAN_METHOD(mouseClick)
71
72
MMMouseButton button = LEFT_BUTTON;
73
74
+ if (args.Length() == 1)
75
+ {
76
+ char *but = (*v8::String::Utf8Value(args[0]->ToString()));
77
+
78
+ if (strcmp(but, "left") == 0)
79
80
+ button = LEFT_BUTTON;
81
+ }
82
+ else if (strcmp(but, "right") == 0)
83
84
+ button = RIGHT_BUTTON;
85
86
+ else if (strcmp(but, "middle") == 0)
87
88
+ button = CENTER_BUTTON;
89
90
+ else
91
92
+ return NanThrowError("Invalid mouse button specified.");
93
94
95
+ else if (args.Length() > 1)
96
97
+ return NanThrowError("Invalid number of arguments.");
98
99
100
clickMouse(button);
101
102
NanReturnValue(NanNew("1"));
0 commit comments