thinking of the following change: When using options
mixin and extend
is on, recursively merge subclass' options with
parent.prototype.options
like it does in MooTools.
use case (now):
require(['prime/prime', 'prime/options'], function(prime, options){
var a = prime({
options: {
x: 1,
y: 1
},
implement: [options],
constructor: function(options){
this.setOptions(options);
}
});
var b = prime({
extend: a,
// need to manually merge now.
options: prime.merge(a.prototype.options, {
z: 1
})
});
console.log(new b().options); // {x:1, y:1, z:1}
});
to change to automatic merge:
require(['prime/prime', 'prime/options'], function(prime, options){
var a = prime({
options: {
x: 1,
y: 1
},
implement: [options],
constructor: function(options){
this.setOptions(options);
}
});
var b = prime({
extend: a,
options: {
z: 1
}
});
console.log(new b().options); // {x:1, y:1, z:1}, currently: {z:1}
});