From f3e186afb197f891914df9767c6f4b79c4578ab7 Mon Sep 17 00:00:00 2001 From: logsol Date: Sun, 15 Jul 2012 22:05:34 +0200 Subject: [PATCH] added Server Factory module and empty notification center. #6 --- lib/Server/Factory.js | 24 ++++++++++++++++++++++++ lib/Server/NotificationCenter.js | 7 +++++++ 2 files changed, 31 insertions(+) create mode 100644 lib/Server/Factory.js create mode 100644 lib/Server/NotificationCenter.js diff --git a/lib/Server/Factory.js b/lib/Server/Factory.js new file mode 100644 index 0000000..e83252b --- /dev/null +++ b/lib/Server/Factory.js @@ -0,0 +1,24 @@ +define(['Server/NotificationCenter'], function(NotificationCenter) { + + function Factory() { + this.notificationCenter = new NotificationCenter(); + } + + Factory.prototype.new = function () { + + if (arguments.length < 1) + throw 'Too fiew arguments'; + if (typeof arguments[0] != 'function') + throw arguments[0] + ' is not a function'; + + var type = arguments[0]; + var object = new (type.bind.apply(type,arguments))(); + object.notificationCenter = this.notificationCenter; + object.factory = this; + return object; + + } + + return Factory; + +}); \ No newline at end of file diff --git a/lib/Server/NotificationCenter.js b/lib/Server/NotificationCenter.js new file mode 100644 index 0000000..26848fc --- /dev/null +++ b/lib/Server/NotificationCenter.js @@ -0,0 +1,7 @@ +define(function() { + + function NotificationCenter() { + } + + return NotificationCenter; +}); \ No newline at end of file