From db1e7e8880106dbff56013bd8db884d96f749b78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Mon, 14 Mar 2011 22:38:40 +0100 Subject: [PATCH] Simple optimisations. --- src/util/Event.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/util/Event.js b/src/util/Event.js index c5627ae1..071d6cab 100644 --- a/src/util/Event.js +++ b/src/util/Event.js @@ -108,14 +108,12 @@ Event.requestAnimationFrame = new function() { focus: function() { focused = true; // Switch to falst checkCallback calls while window is focused. - if (timer) - setTimer(fastRate); + timer && setTimer(fastRate); }, blur: function() { focused = false; // Switch to slow checkCallback calls while window is blured. - if (timer) - setTimer(slowRate); + timer && setTimer(slowRate); } }); @@ -123,7 +121,6 @@ Event.requestAnimationFrame = new function() { if (request) return request(callback, element); callbacks.push([callback, element]); - if (!timer) - setTimer(fastRate); + !timer && setTimer(fastRate); }; };