• function

newInstance can.Construct.newInstance


Returns an instance of can.Construct. This method can be overridden to return a cached instance.



  1. args {*}Optional

    arguments 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.



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.


The following creates a Person Construct and then creates a new instance of Person, using apply on newInstance to pass arbitrary parameters.

var Person = can.Construct({
  init : function(first, middle, last) {
    this.first = first;
    this.middle = middle;
    this.last = last;

var args = ["Justin","Barry","Meyer"],
    justin = new Person.newInstance.apply(null, args);