pub unsafe extern "C" fn JS_InitClass(
cx: *mut JSContext,
obj: Handle<*mut JSObject>,
protoClass: *const JSClass,
protoProto: Handle<*mut JSObject>,
name: *const i8,
constructor: Option<unsafe extern "C" fn(*mut JSContext, u32, *mut Value) -> bool>,
nargs: u32,
ps: *const JSPropertySpec,
fs: *const JSFunctionSpec,
static_ps: *const JSPropertySpec,
static_fs: *const JSFunctionSpec,
) -> *mut JSObjectExpand description
Defines a builtin constructor and prototype. Returns the prototype object.
-
Defines a property named
nameonobj, with its value set to a newly-created JS function that invokes theconstructorJSNative. Thelengthof the function isnargs. -
Creates a prototype object with proto
protoProtoand classprotoClass. IfprotoProtoisnullptr,Object.prototypewill be used instead. IfprotoClassisnullptr, the prototype object will be a plain JS object. -
The
psandfsproperties/functions will be defined on the prototype object. -
The
static_psandstatic_fsproperties/functions will be defined on the constructor.