myFunction(param1, param2) we can just specify the function name to call, and the params to pass.
void ClassListFrame::CallJSFunctionNameWithParams(**const** std::string& jsFunCall)
//A C++ translation of [ WebScriptObject.mm callWebScriptMethod… ]
WebCore::KJSProxy* js = frame->scriptProxy(**)**; KJS::ScriptInterpreter* interp = js->interpreter(**)**; KJS::ExecState* exec = interp->globalExec(**)**; //TODO: error checking ASSERT(!exec->hadException());
KJS::JSLock lock; //look up the function object KJS::JSValue* functionName = KJS::jsString( jsFunCall.c_str(**)** )**;**
KJS::Identifier identifier( functionName->toString(exec) )**;** KJS::JSObject* rootObj = interp->globalObject(**)**;
KJS::JSValue* functionObj = rootObj->get(exec, identifier)**;**
(thank you CodeColorizer! Ugly non-CSS code, but hey…)
int into the appropriate subclass (a kind of encapsulation from what’s actually going on that I don’t think is doable with a subclass approach). Although beyond ease-of-calling (having my “user of the API” hat on) I don’t think I’ll see many benefits to the writer (having my “creator of the API” hat on) to using templates.