JSFiddle - React, Tailwind, and code Playground
by gene
HTML
<script src="https://raw.github.com/SteveSanderson/knockout/master/build/output/knockout-latest.debug.js"></script>
Derived: <div data-bind="text: $data"></div>
JavaScript
function Base(instance, a) {
instance.aProperty = a;
instance.initialize = function() {
this.product = this.aProperty * this.bProperty;
}
}
function Base2(a) {
this.aProperty = a;
this.initialize = function() {
this.product = this.aProperty * this.bProperty;
}
}
function Derived(a, b) {
this.Base = Base2;
this.Base(a);
this.aProperty *= 2;
this.bProperty = b;
this.initialize();
this.toString = function() { return "a = " + this.aProperty + "; b = " + this.bProperty + "; a*b = " + this.product; };
}
ko.applyBindings(new Derived(1, 2));