newInstance
can.Construct.newInstanceReturns an instance of can.Construct
. This method can be overridden to return a cached instance.
can.Construct.newInstance([...args])
Parameters
-
args
{*}
Optionalarguments that get passed to can.Construct.prototype.setup and can.Construct.prototype.init. Note that if can.Construct.prototype.setup returns an array, those arguments will be passed to can.Construct.prototype.init instead.
Returns
{class}
instance of the class
Creates a new instance of the constructor function. This method is useful for creating new instances with arbitrary parameters. Typically, however, you will simply want to call the constructor with the new operator.
Example
The following creates a
Person
Construct and then creates a new instance of Person, usingapply
on newInstance to pass arbitrary parameters.