JSFiddle - React, Tailwind, and code Playground
by Walter Rumsby
JavaScript
Ext.define('A', {
items:[],
constructor: function() {
this.items = Ext.clone(this.items);
this.callParent();
this.modify();
},
modify: function() {
console.assert(!Ext.isArray(this.items));
// This gets applied to prototype
this.items[0].randomKey = true;
// This doesn't
this.items.unshift({
name: 'added',
items: [
{ nested: [ 'deep' ] }
]
});
}
});
Ext.define('B', {
extend: 'A',
items:[
{
name: 'original'
},
{
nested: [ { way: 'deep' } ]
}
]
});
var b = Ext.create('B'),
b2 = Ext.create('B');
console.log(b);
console.log(b2);