{
Try
{
- ContactConverterFactory::ConverterType converter =
- ContactConverterFactory::getConverter(context);
+ JSContactEmailAddressPriv *priv = static_cast<JSContactEmailAddressPriv*>(JSObjectGetPrivate(object));
+ if (!priv) {
+ ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+ }
+ JSContextRef gContext = priv->getContext();
+
+ ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
ContactEmailAddressPtr emailAddress = getPrivData(object);
- return JSContactEmailAddressTypeArray::createArray(context, emailAddress->getTypes());
+
+ if(emailAddress->IsTypesSetJSArray()){
+ return emailAddress->getTypesJSObj();
+ }else{
+ JSValueRef tempJSValue = emailAddress->getTypesJSArray();
+ tempJSValue = converter->toJSValueRef(emailAddress->getTypes());
+
+ JSObjectRef convertedJSObject = emailAddress->getTypesJSObj();
+ convertedJSObject = JSValueToObject( gContext, tempJSValue, NULL );
+ emailAddress->setTypesJSArray(true, convertedJSObject);
+
+ JSValueProtect(gContext, convertedJSObject);
+ emailAddress->setContext(gContext);
+ return tempJSValue;
+ }
}
Catch(WrtDeviceApis::Commons::Exception)
{