Contents

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 jsClass to set the constructor’s .prototype property, and to evaluate instanceof expressions. Pass NULL to use the default object class.

  • callAsConstructor:

    A Jsobjectcallasconstructorcallback to invoke when using your constructor in a new expression. Pass NULL to 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