From 3ee7c197f969fd4dc18f5a6f66bbf59d4087c5d8 Mon Sep 17 00:00:00 2001 From: Jeena Paradies Date: Thu, 19 Jul 2012 16:20:21 +0200 Subject: [PATCH] still not working with create --- Factory.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Factory.js b/Factory.js index b67f223..18e9819 100644 --- a/Factory.js +++ b/Factory.js @@ -11,13 +11,12 @@ Factory.prototype.new = function () { var module = arguments[0]; - return Object.create( - module.prototype, - { - factory: {value: this}, - notificationCenter: {value: this.notificationCenter} - } - ); + var o = Object.create(module.prototype, { + factory: {value: this}, + notificationCenter: {value: this.notificationCenter} + }); + + return new (o.call(arguments))(); } function Player(name) { @@ -36,7 +35,7 @@ var factory = new Factory(); var player = factory.new(Player, "jeena"); -player.factory.new(Player, "logsol").notificationCenter.alert("foo"); +player.factory.new(Player, "logsol").name; /*