ko.utils.setTimeout to native setTimeout

This commit is contained in:
djmaze 2021-09-28 13:45:19 +02:00
parent 9014f08f35
commit 5cb4d338a1
5 changed files with 7 additions and 9 deletions

View file

@ -24,7 +24,7 @@ ko.bindingHandlers['textInput'] = {
// updates that are from the previous state of the element, usually due to techniques
// such as rateLimit. Such updates, if not ignored, can cause keystrokes to be lost.
elementValueBeforeEvent = element.value;
timeoutHandle = ko.utils.setTimeout(updateModel, 4);
timeoutHandle = setTimeout(updateModel, 4);
}
};
@ -36,7 +36,7 @@ ko.bindingHandlers['textInput'] = {
}
if (elementValueBeforeEvent !== undefined && modelValue === elementValueBeforeEvent) {
ko.utils.setTimeout(updateView, 4);
setTimeout(updateView, 4);
return;
}

View file

@ -47,7 +47,7 @@ ko.bindingHandlers['value'] = {
// techniques like rateLimit can trigger model changes at critical moments that will
// override the user's inputs, causing keystrokes to be lost.
elementValueBeforeEvent = ko.selectExtensions.readValue(element);
ko.utils.setTimeout(valueUpdateHandler, 0);
setTimeout(valueUpdateHandler, 0);
};
eventName = eventName.substring(5);
}
@ -72,7 +72,7 @@ ko.bindingHandlers['value'] = {
var elementValue = ko.selectExtensions.readValue(element);
if (elementValueBeforeEvent !== null && newValue === elementValueBeforeEvent) {
ko.utils.setTimeout(updateFromModel, 0);
setTimeout(updateFromModel, 0);
return;
}