INNER CODE UNIT · JavaScript
KeyUpEventDelay
Keyfactor/signserver-ce · signserver/modules/SignServer-Admin-web/src/main/webapp/resources/community/js/ejbca-common.js:177
function KeyUpEventDelay(inputElement, timeoutMs) {
var instance = this;
this.component = inputElement;
this.originalHandler = inputElement.onkeyup;
this.timeout = timeoutMs;
this.timer = 0;
this.delay = function(event) {
// Reschedule (prevent) any existing timeout to the original handler and schedule a new one
window.clearTimeout(instance.timer);
instance.timer = window.setTimeout(function() { instance.originalHandler.call(instance.component, event); }, instance.timeout);
};
if (this.originalHandler) {
this.component.onkeyup = this.delay;
}
};