From b8bfcdf7438d1b6526031ddba66d41217ea535d5 Mon Sep 17 00:00:00 2001 From: Ryan McGrath Date: Sun, 10 Jul 2011 04:24:44 -0400 Subject: [PATCH] Demo cleanup/enhance --- js/wii.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/js/wii.js b/js/wii.js index 2f57a33..ffa3d7b 100644 --- a/js/wii.js +++ b/js/wii.js @@ -155,10 +155,8 @@ Wii.parsePrimaryWiimote = function(e) { * Filter down and figure out which "event" we're really looking at based on code * matchups; this gets messy pretty quickly... */ - if(typeof buttonPressed !== 'undefined' && wii_remote.evtsInterestedIn[buttonPressed] !== 'undefined') { - alert(typeof buttonPressed + ' || ' + buttonPressed); - alert(wii_remote.evtsInterestedIn[buttonPressed]); - try { wii_remote.evtsInterestedIn[buttonPressed](wii_remote, wii_remoteCurrStatus); } catch(e) { alert(e.message); alert(Wii.currentBrowsingRemote); } + if(typeof buttonPressed !== 'undefined' && typeof wii_remote.evtsInterestedIn[buttonPressed] === 'function') { + wii_remote.evtsInterestedIn[buttonPressed](wii_remote, wii_remoteCurrStatus); } /* Doing this in conjunction with preventDefault() halts an odd clicking bug or two. */