diff --git a/app/Game/Client/GameController.js b/app/Game/Client/GameController.js index 940dba6..c53f026 100755 --- a/app/Game/Client/GameController.js +++ b/app/Game/Client/GameController.js @@ -38,10 +38,6 @@ function(Parent, PhysicsEngine, ViewController, KeyboardController, requestAnimF } } - GameController.prototype.destroy = function() { - Parent.prototype.destroy.call(this); - } - GameController.prototype.meJoined = function(user) { this.me = this.userJoined(user); this.keyboardController = new KeyboardController(this.me, this); diff --git a/app/Game/Server/NotificationCenter.js b/app/Game/Server/NotificationCenter.js old mode 100644 new mode 100755 index 976c450..b243c28 --- a/app/Game/Server/NotificationCenter.js +++ b/app/Game/Server/NotificationCenter.js @@ -1,11 +1,15 @@ -define(function() { +define([ +], - function NotificationCenter() { +function() { + + function NotificationCenter() { this.topics = {}; this.subUid = -1; - } + } NotificationCenter.prototype.trigger = function(topic, args) { + if (!this.topics[topic]) { throw "No such topic " + topic + ". Could not trigger."; } @@ -16,11 +20,10 @@ define(function() { while (len--) { subscribers[len].func(topic, args); } - - return this; } NotificationCenter.prototype.on = function(topic, func) { + if (!this.topics[topic]) { this.topics[topic] = []; } @@ -46,8 +49,7 @@ define(function() { } } } - return this; } - return NotificationCenter; + return new NotificationCenter(); // making it singletone }); \ No newline at end of file