From ea62efa9475757a3d1764e435952718cf515627a Mon Sep 17 00:00:00 2001 From: Jason Stallings Date: Fri, 30 Jan 2015 10:06:03 -0600 Subject: [PATCH] Converted typeString to use nan. Closes #1. --- src/robotjs.cc | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/robotjs.cc b/src/robotjs.cc index 34c15759..0d85ed1f 100644 --- a/src/robotjs.cc +++ b/src/robotjs.cc @@ -66,20 +66,6 @@ NAN_METHOD(mouseClick) |___/ */ -char *get(v8::Local value, const char *fallback = "") -{ - if (value->IsString()) - { - v8::String::AsciiValue string(value); - char *str = (char *) malloc(string.length() + 1); - strcpy(str, *string); - return str; - } - char *str = (char *) malloc(strlen(fallback) + 1); - strcpy(str, fallback); - return str; -} - NAN_METHOD (keyTap) { NanScope(); @@ -96,8 +82,11 @@ NAN_METHOD (keyTap) NAN_METHOD (typeString) { NanScope(); + + char *str; + NanUtf8String string(args[0]); - char *str = get(args[0]->ToString()); + str= *string; typeString(str);