This article needs a technical review. How you can help.
JSHasInstanceOp
is the type of JSClass.hasInstance
.
Syntax
typedef bool (* JSHasInstanceOp)(JSContext *cx, JS::HandleObject obj, JS::MutableHandleValue vp, bool *bp);
Name | Type | Description |
---|---|---|
cx |
JSContext * |
The JS context in which the type check is occurring. |
obj |
JS::HandleObject |
The "type" in the type check. |
v |
JS::MutableHandleValue |
The value whose type is being checked. |
bp |
bool * |
Out parameter. On success, the callback stores the result of the type check in *bp . |
Description
JSHasInstanceOp
is called to check whether v
is an instance of obj
. Return false
on error or exception, true
on success with true
in *bp
if v
is an instance of obj
, false
in *bp
otherwise.
JSClass
hooks
JSClass offers the following hook:
-
The
JSClass.hasInstance
callback implementsJS_HasInstance
and the JavaScriptinstanceof
keyword.