JSObjectMakeConstructor(_:_:_:)
Creates a JavaScript constructor.
Declaration
func JSObjectMakeConstructor(_ ctx: JSContextRef!, _ jsClass: JSClassRef!, _ callAsConstructor: JSObjectCallAsConstructorCallback!) -> JSObjectRef!Parameters
- ctx:
The execution context to use.
- jsClass:
A Jsclassref that is the class your constructor assigns to the objects its constructs. It uses
jsClassto set the constructor’s.prototypeproperty, and to evaluateinstanceofexpressions. PassNULLto use the default object class. - callAsConstructor:
A Jsobjectcallasconstructorcallback to invoke when using your constructor in a
newexpression. PassNULLto use the default object constructor.
Return Value
A JSObjectRef that is a constructor. The object’s prototype is the default object prototype.
Discussion
The default object constructor takes no arguments, and constructs an object of class jsClass with no private data.
See Also
Working with Objects
JSObjectCallAsConstructor(_:_:_:_:_:)JSObjectCallAsFunction(_:_:_:_:_:_:)JSObjectCopyPropertyNames(_:_:)JSObjectDeleteProperty(_:_:_:_:)JSObjectGetPrivate(_:)JSObjectGetProperty(_:_:_:_:)JSObjectGetPropertyAtIndex(_:_:_:_:)JSObjectGetPrototype(_:_:)JSObjectHasProperty(_:_:_:)JSObjectIsConstructor(_:_:)JSObjectIsFunction(_:_:)JSObjectMake(_:_:_:)JSObjectMakeArray(_:_:_:_:)JSObjectMakeDate(_:_:_:_:)JSObjectMakeError(_:_:_:_:)