}
JSObjectRef JSApplicationEvent::createJSObject(JSContextRef context,
- const std::string eventCode,
- const ApplicationInformationPtr &appinfo)
+ const std::string eventCode,
+ const ApplicationInformationPtr &appinfo)
{
ApplicationEventPtr privateData = ApplicationEventPtr(new ApplicationEvent());
privateData->setCode(eventCode);
privateData->setApplicationInformation(appinfo);
JSApplicationEventPriv *priv = new JSApplicationEventPriv(context, privateData);
+
JSObjectRef jsObjRef = JSObjectMake(context, getClassRef(), static_cast<void*>(priv));
if (NULL == jsObjRef) {
LogError("object creation error");
void JSApplicationEvent::initialize(JSContextRef context,JSObjectRef object)
{
+
}
void JSApplicationEvent::finalize(JSObjectRef object)
{
+
}
JSValueRef JSApplicationEvent::getProperty(JSContextRef context,
- JSObjectRef object,
- JSStringRef propertyName,
- JSValueRef* exception)
+ JSObjectRef object,
+ JSStringRef propertyName,
+ JSValueRef* exception)
{
LogDebug("Enter");
- JSApplicationEventPriv *priv =
- static_cast<JSApplicationEventPriv*>(JSObjectGetPrivate(object));
+ JSApplicationEventPriv *priv = static_cast<JSApplicationEventPriv*>(JSObjectGetPrivate(object));
assert(priv && "Private object not set.");
- Try {
+ Try {
ApplicationEventPtr appEvent = priv->getObject();
Converter convert(context);
if (JSStringIsEqualToUTF8CString(propertyName, APPLICATION_EVENT_CODE)) {
- LogDebug(
- "JSApplicationEvent::getProperty ::code " <<appEvent->getCode());
+ LogDebug("JSApplicationEvent::getProperty ::code " <<appEvent->getCode());
return convert.toJSValueRef(appEvent->getCode());
- }else if (JSStringIsEqualToUTF8CString(propertyName,
- APPLICATION_EVENT_APPLICATIONINFORMATION)) {
- LogDebug(
- "JSApplicationEvent::getProperty ::applicationInformation");
+
+ } else if (JSStringIsEqualToUTF8CString(propertyName, APPLICATION_EVENT_APPLICATIONINFORMATION)) {
+ LogDebug("JSApplicationEvent::getProperty ::applicationInformation");
ApplicationInformationPtr appinfo = appEvent->getApplicationInformation();
ApplicationConverterFactory::ConverterType converter = ApplicationConverterFactory::getConverter(context);
JSValueRef result = converter->toJSValueRef(appinfo);
return result;
- }
- else
- {
+
+ } else {
LogError("wrong property");
}
- }
- Catch(WrtDeviceApis::Commons::Exception) {
+ } Catch (WrtDeviceApis::Commons::Exception) {
LogError("Exception: " << _rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception,JSTizenException::UNKNOWN_ERROR, "Unknown error");
}
+
return JSValueMakeUndefined(context);
}
bool JSApplicationEvent::hasInstance(JSContextRef context,
- JSObjectRef constructor,
- JSValueRef possibleInstance,
- JSValueRef* exception)
+ JSObjectRef constructor,
+ JSValueRef possibleInstance,
+ JSValueRef* exception)
{
return JSValueIsObjectOfClass(context, possibleInstance, getClassRef());
}
+
}
}
}