From dfa0a9b8eba91612acf887a536954977e0cbe943 Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 30 Jun 2012 11:21:23 +0200 Subject: [PATCH] set interval between 'keys' events to 250 ms --- source/Ox.UI/js/Core/Keyboard.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/Ox.UI/js/Core/Keyboard.js b/source/Ox.UI/js/Core/Keyboard.js index 9bbd4d33..ca51c8c8 100644 --- a/source/Ox.UI/js/Core/Keyboard.js +++ b/source/Ox.UI/js/Core/Keyboard.js @@ -63,12 +63,12 @@ Ox.Keyboard = (function() { // clear the trigger timeout only if the key went into the buffer clearTimeout(triggerTimeout); triggerTimeout = setTimeout(function() { - focused !== null && Ox.UI.elements[focused].triggerEvent('keys', { - keys: buffer - }); - }, 25); - // fixme: used to be 250, but seemed too much. - // if it stays at 25, we may not need a timeout at all + if (focused !== null) { + Ox.UI.elements[focused].triggerEvent('keys', { + keys: buffer + }); + } + }, 250); } } // clear the reset timeout even if the key didn't go into the buffer @@ -77,7 +77,7 @@ Ox.Keyboard = (function() { buffer = ''; }, 1000); - //Firefox will cancel active XMLHttpRequests otherwise + // Firefox cancels active XMLHttpRequests when pressing escape if (keyName == 'escape') { event.preventDefault(); }