JS_BindCallable

This article covers features introduced in SpiderMonkey 17

Bind the given callable to use the given object as this.

Syntax

JSObject*
JS_BindCallable(JSContext *cx, JS::Handle<JSObject*> callable,
                JS::Handle<JSObject*> newThis);
Name Type Description
cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.
callable JS::Handle&lt;JSObject*&gt; Pointer to the function object to bind new this.
newThis JS::Handle&lt;JSObject*&gt; Pointer to the new this value for callable.

Description

JS_BindCallable binds the given callable to use the given object as this.

If callable is not callable, will throw and return nullptr.

See Also