From dba03a90555d9f8516551ddf2e1758c37ca60c25 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 5 Mar 2013 03:09:03 -0500 Subject: explicit scope for duders --- public/js/game.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/public/js/game.js b/public/js/game.js index f095c4b..a4cf74b 100644 --- a/public/js/game.js +++ b/public/js/game.js @@ -101,13 +101,15 @@ var Events = { // Explicit changes to the UI when moving from one state to another. // This is for things like moving divs off the screen, changing bindings, etc. // Anything a load method does should be undone by the unload method.. for now. +// These are all functions so they can have their own weirdo scope.. +// I should have started doing it like this a long time ago! var UI = {}; -UI[ State.WAITING ] = { - load: function(data){ +UI[ State.WAITING ] = new function() { + this.load = function(data){ $("#current-state").html("Waiting"); $("#drawing").show(); - }, - unload: function(){ + } + this.unload = function(){ $("#drawing").hide(); } } @@ -161,11 +163,11 @@ UI[ State.WINNING ] = new function(){ } } -UI[ State.RESET ] = { - load: function(data){ +UI[ State.RESET ] = new function() { + this.load = function(data){ $("#current-state").html("whoahao RESET!"); - }, - unload: function(){ + } + this.unload = function(){ } } -- cgit v1.2.3-70-g09d2