This example shows how to inherit Classes. Every master-class should be defined using ITSA.Classes.createClass(). From that point out, Classes can be inherited by using subClass of the parent-Class.
Click on the buttons to make the users speak or be silent.
Code-example:
<body>
<button id="btnMaster">Print Master values</button>
<div id="cont"></div>
</body>
<script src="itsabuild-min.js"></script>
<script>
var container = document.getElement('#cont'),
MasterClass, SubClass, SubSubClass, master, sub, subsub;
MasterClass = ITSA.Classes.createClass(
function(x) {
this.x = x;
},
{
getValues: function() {
return 'x: '+this.x;
}
}
);
master = new MasterClass(10);
MasterClass.mergePrototypes({
getValues: function() {
return 'values of SubSubClass-instance --> '+this.$orig();
}
}, true);
ITSA.Event.after('tap', function(e) {
container.setHTML(master.getValues());
}, '#btnMaster');
</script>