Demo cleanup/enhance

This commit is contained in:
Ryan McGrath 2011-07-10 04:26:10 -04:00
parent b8bfcdf743
commit 84d2e8b9c1

View file

@ -106,7 +106,7 @@ Wii.listen = function() {
} else { } else {
for(var evt in wii_remote.evtsInterestedIn) { for(var evt in wii_remote.evtsInterestedIn) {
var evtHappened = Wii.DISPATCHER[evt](wii_remote, wii_remoteCurrStatus); 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... * matchups; this gets messy pretty quickly...
*/ */
if(typeof buttonPressed !== 'undefined' && typeof wii_remote.evtsInterestedIn[buttonPressed] === 'function') { 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. */ /* Doing this in conjunction with preventDefault() halts an odd clicking bug or two. */