diff options
| author | Jules Laplace <jules@okfoc.us> | 2013-03-05 03:09:03 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2013-03-05 03:09:03 -0500 |
| commit | dba03a90555d9f8516551ddf2e1758c37ca60c25 (patch) | |
| tree | a78fce46dac68abb425c33a9a5c783f30f5c8c4c /public/js | |
| parent | 22c7945ab532a3fddf0f211108e6063790821272 (diff) | |
explicit scope for duders
Diffstat (limited to 'public/js')
| -rw-r--r-- | public/js/game.js | 18 |
1 files 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(){ } } |
