File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -292,6 +292,22 @@ NAN_METHOD(getPixelColor)
292
292
NanReturnValue (NanNew (hex));
293
293
}
294
294
295
+ NAN_METHOD (getScreenSize)
296
+ {
297
+ NanScope ();
298
+
299
+ // Get display size.
300
+ MMSize displaySize = getMainDisplaySize ();
301
+
302
+ // Create our return object.
303
+ Local<Object> obj = NanNew<Object>();
304
+ obj->Set (NanNew<String>(" width" ), NanNew<Number>(displaySize.width ));
305
+ obj->Set (NanNew<String>(" height" ), NanNew<Number>(displaySize.height ));
306
+
307
+ // Return our object with .width and .height.
308
+ NanReturnValue (obj);
309
+ }
310
+
295
311
void init (Handle<Object> target)
296
312
{
297
313
@@ -319,6 +335,9 @@ void init(Handle<Object> target)
319
335
target->Set (NanNew<String>(" getPixelColor" ),
320
336
NanNew<FunctionTemplate>(getPixelColor)->GetFunction ());
321
337
338
+ target->Set (NanNew<String>(" getScreenSize" ),
339
+ NanNew<FunctionTemplate>(getScreenSize)->GetFunction ());
340
+
322
341
}
323
342
324
343
NODE_MODULE (robotjs, init)
You can’t perform that action at this time.
0 commit comments