JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.2.0/knockout-debug.js"></script>
JavaScript
var Start = function() {
this.prop1 = ko.observable(1).extend({ rateLimit: 0 });
this.prop2 = ko.observable(2).extend({ rateLimit: 0 });
this.prop3 = ko.observable(3).extend({ rateLimit: 0 });
this.prop4 = ko.observable(4).extend({ rateLimit: 0 });
};
var start = new Start();
var m = start;
var i = 20;
while (i--) {
m = (function(m) {
var Middle = function() {
this.prop1 = ko.pureComputed(function() { return this.prop2(); }, m)
.extend({ rateLimit: 0 });
this.prop2 = ko.pureComputed(function() { return this.prop1() - this.prop3(); }, m)
.extend({ rateLimit: 0 });
this.prop3 = ko.pureComputed(function() { return this.prop2() + this.prop4(); }, m)
.extend({ rateLimit: 0 });
this.prop4 = ko.pureComputed(function() { return this.prop3(); }, m)
.extend({ rateLimit: 0 });
};
var s = new Middle();
return s;
})(m);
}
var end = m;
console.log(end.prop1());
console.log(end.prop2());
console.log(end.prop3());
console.log(end.prop4());
// end.prop2.subscribe(function() {
// console.log(123);
// });
var st = Date.now();
start.prop1(4);
start.prop2(3);
start.prop3(2);
start.prop4(1);
console.log('--------');
console.log(end.prop1());
console.log(end.prop2());
console.log(end.prop3());
console.log(end.prop4());
console.log('--------');
console.log(Date.now() - st);