Class.addConstructor

Value addConstructor(alias Ctor)(string name = null) if (isCallable!Ctor && is(ReturnType!Ctor : Object)) nothrow

Add a constructor to a Class. If name is empty (null), the class name will be used. After creating the constructor, it needs to be added to an object as a property to be able to use it. Use Context.setValue to make the constructor available in the global object.

Parameters

nameThe JSC name of the constructor or null to use the class name
callbackThe callback

Returns

A Value representing the class constructor