Do not use 'event' as variable name

This commit is contained in:
Charles Gould 2017-04-30 19:02:05 -04:00
parent 9b143b96e9
commit 10707e4e7b

View File

@ -167,16 +167,16 @@ var vm = new Vue({
} }
return null; return null;
}, },
hostGame: function(event) { hostGame: function(e) {
client.send('/app/hostGame'); client.send('/app/hostGame');
}, },
joinGame: function(event) { joinGame: function(e) {
// Discard 'game-' prefix // Discard 'game-' prefix
var buttonId = event.target.id; var buttonId = e.target.id;
var gameId = buttonId.substr(5); var gameId = buttonId.substr(5);
client.send('/app/joinGame', {}, gameId); client.send('/app/joinGame', {}, gameId);
}, },
leaveGame: function(event) { leaveGame: function(e) {
client.send('/app/leaveGame'); client.send('/app/leaveGame');
}, },
removeGame: function(gameId) { removeGame: function(gameId) {
@ -189,13 +189,13 @@ var vm = new Vue({
} }
this.games.splice(indexToRemove, 1); this.games.splice(indexToRemove, 1);
}, },
onCanvasKeydown: function(event) { onCanvasKeydown: function(e) {
if (event.which === KEYCODE_BACKSPACE) { if (e.which === KEYCODE_BACKSPACE) {
event.preventDefault(); e.preventDefault();
this.myGuess = this.myGuess.substr(0, this.myGuess.length - 1); this.myGuess = this.myGuess.substr(0, this.myGuess.length - 1);
this.repaint(); this.repaint();
} }
else if (event.which === KEYCODE_RETURN) { else if (e.which === KEYCODE_RETURN) {
if (this.myGuess.length === 5) { if (this.myGuess.length === 5) {
client.send("/app/guess", {}, this.myGuess); client.send("/app/guess", {}, this.myGuess);
this.myGuess = ''; this.myGuess = '';
@ -203,8 +203,8 @@ var vm = new Vue({
} }
} }
}, },
onCanvasKeypress: function(event) { onCanvasKeypress: function(e) {
var charCode = event.charCode; var charCode = e.charCode;
if (isCharacter(charCode)) { if (isCharacter(charCode)) {
if (isCharacterLowercase(charCode)) { if (isCharacterLowercase(charCode)) {
charCode = charCode - 32; charCode = charCode - 32;
@ -216,12 +216,12 @@ var vm = new Vue({
} }
} }
}, },
onChatKeypress: function(event) { onChatKeypress: function(e) {
var messageInput = event.target; var messageInput = e.target;
if (event.which === KEYCODE_RETURN) { if (e.which === KEYCODE_RETURN) {
// Shift+Enter -> new line // Shift+Enter -> new line
if (!event.shiftKey) { if (!e.shiftKey) {
event.preventDefault(); e.preventDefault();
var text = messageInput.value.trim(); var text = messageInput.value.trim();
if (text.length === 0) { if (text.length === 0) {
return; return;
@ -293,8 +293,8 @@ function main() {
}; };
usernameInput.addEventListener('keydown', function(e) { usernameInput.addEventListener('keydown', function(e) {
if (event.keyCode === KEYCODE_RETURN) { if (e.keyCode === KEYCODE_RETURN) {
event.preventDefault(); e.preventDefault();
if (sessionId === null) { if (sessionId === null) {
vm.usernameError = 'Not connected to server'; vm.usernameError = 'Not connected to server';
return; return;