From 84d2e8b9c1e30acb72f21fe538ec63ef1d556929 Mon Sep 17 00:00:00 2001 From: Ryan McGrath Date: Sun, 10 Jul 2011 04:26:10 -0400 Subject: [PATCH] Demo cleanup/enhance --- js/wii.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/wii.js b/js/wii.js index ffa3d7b..8e53ede 100644 --- a/js/wii.js +++ b/js/wii.js @@ -106,7 +106,7 @@ Wii.listen = function() { } else { for(var evt in wii_remote.evtsInterestedIn) { var evtHappened = Wii.DISPATCHER[evt](wii_remote, wii_remoteCurrStatus); - if(evtHappened) try { wii_remote.evtsInterestedIn[evt](wii_remote, wii_remoteCurrStatus); } catch(e) { alert(e.message); } + if(evtHappened) wii_remote.evtsInterestedIn[evt](wii_remote, wii_remoteCurrStatus); } } } @@ -156,7 +156,8 @@ Wii.parsePrimaryWiimote = function(e) { * matchups; this gets messy pretty quickly... */ if(typeof buttonPressed !== 'undefined' && typeof wii_remote.evtsInterestedIn[buttonPressed] === 'function') { - wii_remote.evtsInterestedIn[buttonPressed](wii_remote, wii_remoteCurrStatus); + try { wii_remote.evtsInterestedIn[buttonPressed](wii_remote, wii_remoteCurrStatus); + } catch(e) { alert(e.message); } } /* Doing this in conjunction with preventDefault() halts an odd clicking bug or two. */