From f572ad9c0a474c039a196d9aa0a5a3970a47542b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Thu, 27 Jun 2013 04:11:50 -0700 Subject: [PATCH] Improve handling of Stats. Don't bail out if the library is not loaded. --- examples/Games/Paperoids.html | 136 +++++++++++++++++----------------- src/ui/View.js | 3 +- 2 files changed, 68 insertions(+), 71 deletions(-) diff --git a/examples/Games/Paperoids.html b/examples/Games/Paperoids.html index c187bb91..d39b1483 100644 --- a/examples/Games/Paperoids.html +++ b/examples/Games/Paperoids.html @@ -5,7 +5,6 @@ Paperoids - - + + - - -
FPS
- +
Game Over. Play again?
diff --git a/src/ui/View.js b/src/ui/View.js index 289df0dc..498070b7 100644 --- a/src/ui/View.js +++ b/src/ui/View.js @@ -74,7 +74,8 @@ var View = Base.extend(Callback, /** @lends View# */{ element.width = size.width; element.height = size.height; // TODO: Test this on IE: - if (PaperScope.hasAttribute(element, 'stats')) { + if (PaperScope.hasAttribute(element, 'stats') + && typeof Stats !== 'undefined') { this._stats = new Stats(); // Align top-left to the element var stats = this._stats.domElement,