mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
still not working with create
This commit is contained in:
parent
d3e7389c57
commit
3ee7c197f9
1 changed files with 7 additions and 8 deletions
15
Factory.js
15
Factory.js
|
|
@ -11,13 +11,12 @@ Factory.prototype.new = function () {
|
||||||
|
|
||||||
var module = arguments[0];
|
var module = arguments[0];
|
||||||
|
|
||||||
return Object.create(
|
var o = Object.create(module.prototype, {
|
||||||
module.prototype,
|
factory: {value: this},
|
||||||
{
|
notificationCenter: {value: this.notificationCenter}
|
||||||
factory: {value: this},
|
});
|
||||||
notificationCenter: {value: this.notificationCenter}
|
|
||||||
}
|
return new (o.call(arguments))();
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Player(name) {
|
function Player(name) {
|
||||||
|
|
@ -36,7 +35,7 @@ var factory = new Factory();
|
||||||
|
|
||||||
var player = factory.new(Player, "jeena");
|
var player = factory.new(Player, "jeena");
|
||||||
|
|
||||||
player.factory.new(Player, "logsol").notificationCenter.alert("foo");
|
player.factory.new(Player, "logsol").name;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue