Closed AntonBaukin closed 10 years ago
Please, introduce $class field in each instance created. Using it the example provided:
var Student = Class(Person, { constructor: function(id, name, age) { this.id = id; Student.$super.call(this, name, age); // Invoke parent's constructor } })
may be written as:
var api = { constructor: function(id, name, age) { this.id = id; this.$class.$super.call(this, name, age); // Invoke parent's constructor } }
var Student = Class(Person, api)
This allows to use API mixins when the real class name is not known.
Love the great idea. I will implement $class in v2.2.0 (coming soon).
Thanks Anton!
Tan
Fixed
Please, introduce $class field in each instance created. Using it the example provided:
var Student = Class(Person, { constructor: function(id, name, age) { this.id = id; Student.$super.call(this, name, age); // Invoke parent's constructor } })
may be written as:
var api = { constructor: function(id, name, age) { this.id = id; this.$class.$super.call(this, name, age); // Invoke parent's constructor } }
var Student = Class(Person, api)
This allows to use API mixins when the real class name is not known.