Changeset View
Changeset View
Standalone View
Standalone View
source/gui/ObjectBases/IGUIObject.cpp
Show First 20 Lines • Show All 425 Lines • ▼ Show 20 Lines | bool IGUIObject::ScriptEventWithReturn(const CStr& eventName, const JS::HandleValueArray& paramData) | ||||
JSContext* cx = m_pGUI.GetScriptInterface()->GetContext(); | JSContext* cx = m_pGUI.GetScriptInterface()->GetContext(); | ||||
JSAutoRequest rq(cx); | JSAutoRequest rq(cx); | ||||
JS::RootedObject obj(cx, GetJSObject()); | JS::RootedObject obj(cx, GetJSObject()); | ||||
JS::RootedValue handlerVal(cx, JS::ObjectValue(*it->second)); | JS::RootedValue handlerVal(cx, JS::ObjectValue(*it->second)); | ||||
JS::RootedValue result(cx); | JS::RootedValue result(cx); | ||||
if (!JS_CallFunctionValue(cx, obj, handlerVal, paramData, &result)) | if (!JS_CallFunctionValue(cx, obj, handlerVal, paramData, &result)) | ||||
{ | { | ||||
JS_ReportError(cx, "Errors executing script event \"%s\"", eventName.c_str()); | LOGERROR("Errors executing script event \"%s\"", eventName.c_str()); | ||||
return false; | return false; | ||||
} | } | ||||
return JS::ToBoolean(result); | return JS::ToBoolean(result); | ||||
} | } | ||||
void IGUIObject::CreateJSObject() | void IGUIObject::CreateJSObject() | ||||
{ | { | ||||
JSContext* cx = m_pGUI.GetScriptInterface()->GetContext(); | JSContext* cx = m_pGUI.GetScriptInterface()->GetContext(); | ||||
▲ Show 20 Lines • Show All 99 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator