Skip to main content

JS_NewCConstructor

Function JS_NewCConstructor 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn JS_NewCConstructor( ctx: *mut JsContext, class_id: c_int, name: *const c_char, func: RawFunction, length: c_int, cproto: c_int, magic: c_int, parent_ctor: JsValue, ctor_fields: *const JSCFunctionListEntry, n_ctor_fields: c_int, proto_fields: *const JSCFunctionListEntry, n_proto_fields: c_int, _flags: c_int, ) -> JsValue
Expand description

JS_NewCConstructor: the one-call constructor registration.

This is JS_NewClassID + JS_NewClass + JS_NewObjectProtoClass’s prototype + JS_NewCFunction2 + JS_SetConstructor + JS_SetPropertyFunctionList folded into one entry point, which is why the reference added it: a module that spells it out is 30 lines of boilerplate and gets one of the six steps wrong.

§Safety

name must be NUL-terminated; the two field tables must point at the given counts of live entries; parent_ctor must be null or a live JSValue.