Cleanup JS and better terser compression

This commit is contained in:
djmaze 2020-10-09 11:58:15 +02:00
parent 058217de02
commit ba7ed497b2
20 changed files with 247 additions and 298 deletions

View file

@ -1,6 +1,6 @@
var computedState = Symbol('_state');
ko.computed = ko.dependentObservable = function (evaluatorFunctionOrOptions, evaluatorFunctionTarget, options) {
ko.computed = function (evaluatorFunctionOrOptions, evaluatorFunctionTarget, options) {
if (typeof evaluatorFunctionOrOptions === "object") {
// Single-parameter syntax - everything is on this "options" param
options = evaluatorFunctionOrOptions;
@ -498,7 +498,6 @@ ko.isComputed = instance => (typeof instance == 'function' && instance[protoProp
ko.isPureComputed = instance => ko.isComputed(instance) && instance[computedState] && instance[computedState].pure;
ko.exportSymbol('computed', ko.computed);
ko.exportSymbol('dependentObservable', ko.computed); // export ko.dependentObservable for backwards compatibility (1.x)
ko.exportSymbol('isComputed', ko.isComputed);
ko.exportSymbol('isPureComputed', ko.isPureComputed);
ko.exportSymbol('computed.fn', computedFn);

View file

@ -9,7 +9,7 @@ ko.extenders = {
// (2) For writable targets (observables, or writable dependent observables), we throttle *writes*
// so the target cannot change value synchronously or faster than a certain rate
var writeTimeoutInstance = null;
return ko.dependentObservable({
return ko.computed({
'read': target,
'write': value => {
clearTimeout(writeTimeoutInstance);