Changeset View
Changeset View
Standalone View
Standalone View
source/gui/ObjectBases/IGUIObject.cpp
Show First 20 Lines • Show All 412 Lines • ▼ Show 20 Lines | if (it == m_ScriptHandlers.end()) | ||||
return; | return; | ||||
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)) | JS_CallFunctionValue(cx, obj, handlerVal, paramData, &result); | ||||
JS_ReportError(cx, "Errors executing script event \"%s\"", eventName.c_str()); | |||||
} | } | ||||
void IGUIObject::CreateJSObject() | void IGUIObject::CreateJSObject() | ||||
{ | { | ||||
JSContext* cx = m_pGUI.GetScriptInterface()->GetContext(); | JSContext* cx = m_pGUI.GetScriptInterface()->GetContext(); | ||||
JSAutoRequest rq(cx); | JSAutoRequest rq(cx); | ||||
m_JSObject.init(cx, m_pGUI.GetScriptInterface()->CreateCustomObject("GUIObject")); | m_JSObject.init(cx, m_pGUI.GetScriptInterface()->CreateCustomObject("GUIObject")); | ||||
▲ Show 20 Lines • Show All 96 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator