这篇翻译不完整。请帮忙从英语翻译这篇文章

This article covers features introduced in SpiderMonkey 17

调用指定的JS函数。

句法

bool
JS::Call(JSContext *cx, JS::HandleObject thisObj, JS::HandleFunction fun,
         const JS::HandleValueArray &args, JS::MutableHandleValue rval);

bool
JS::Call(JSContext *cx, JS::HandleObject thisObj, const char *name,
         const JS::HandleValueArray& args, JS::MutableHandleValue rval);

bool
JS::Call(JSContext *cx, JS::HandleObject thisObj, JS::HandleValue fun,
         const JS::HandleValueArray& args, JS::MutableHandleValue rval);

bool
JS::Call(JSContext *cx, JS::HandleValue thisv, JS::HandleValue fun,
         const JS::HandleValueArray& args, JS::MutableHandleValue rval);

bool
JS::Call(JSContext *cx, JS::HandleValue thisv, JS::HandleObject funObj,
         const JS::HandleValueArray& args, JS::MutableHandleValue rval);
名称 类型 描述
cx JSContext * 指向JS上下文的指针,从中可以派生运行时信息。Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.
thisObj JS::HandleObject / JS::HandleValue The "current" object on which the function operates; the object specified here is "this" when the function executes.
fun / funObj JS::HandleFunction / JS::HandleValue / JS::HandleObject Pointer to the function to call. Should be a native function or JSAPI-compiled function.
name const char * Pointer to the function name to call.
args JS::HandleValueArray & Arguments to pass to the function.
rval JS::MutableHandleValue Out parameter. On success, *rval receives the return value from the function call.

Description

JS::Callfun在对象上调用指定的函数thisObj在函数执行方面,该对象被视为this

有关更多详细信息,请参阅JS_CallFunctionJS_CallFunctionNameJS_CallFunctionValue

也可以看看

文档标签和贡献者

此页面的贡献者: ewfian, wangyaxinone
最后编辑者: ewfian,