From 043f2dbfda455b55986d0e73888fa54557f229a4 Mon Sep 17 00:00:00 2001 From: Jeena Paradies Date: Sat, 21 Jul 2012 00:50:45 +0200 Subject: [PATCH] added Factory --- lib/Server/Channel.js | 4 +--- lib/Server/Coordinator.js | 5 +++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/Server/Channel.js b/lib/Server/Channel.js index f4ace36..29343e0 100644 --- a/lib/Server/Channel.js +++ b/lib/Server/Channel.js @@ -1,8 +1,6 @@ -define(["Chuck/ServerGame", "Server/Factory"], function(ServerGame, Factory) { +define(["Chuck/ServerGame"], function(ServerGame) { function Channel(name) { - this.factory = new Factory(); - this.name = name; this.users = {}; this.serverGame = this.factory.new(ServerGame, this); diff --git a/lib/Server/Coordinator.js b/lib/Server/Coordinator.js index cd5d1da..3a71f80 100644 --- a/lib/Server/Coordinator.js +++ b/lib/Server/Coordinator.js @@ -1,4 +1,4 @@ -define(["Server/User", "Server/Channel"], function(User, Channel) { +define(["Server/User", "Server/Channel", "Server/Factory"], function(User, Channel, Factory) { function Coordinator() { this.channels = {}; @@ -30,7 +30,8 @@ define(["Server/User", "Server/Channel"], function(User, Channel) { var channel = this.channels[channelName]; if(!channel) { - channel = new Channel(channelName); + var factory = new Factory(); + channel = factory.new(Channel, channelName); this.channels[channelName] = channel; }