constructor

  • property
can.Construct.prototype.constructor

{Object}

 

A reference to the constructor function that created the instance. This allows you to access the constructor's static properties from an instance.

Object

Example

This can.Construct has a static counter that counts how many instances have been created:

can.Construct.extend("Counter", {
    count: 0
}, {
    init: function() {
        this.constructor.count++;
    }
});

new Counter();
Counter.count; // 1