From 22a66cb6e243a3f1c867b62e3942fd2e828019d9 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 8 Mar 2012 13:56:09 -0800 Subject: integrating v0.7 montage into ninja Signed-off-by: Valerio Virgillito --- node_modules/montage/core/core.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'node_modules/montage/core/core.js') diff --git a/node_modules/montage/core/core.js b/node_modules/montage/core/core.js index ff94f303..8fcf7977 100755 --- a/node_modules/montage/core/core.js +++ b/node_modules/montage/core/core.js @@ -71,14 +71,14 @@ Object.defineProperty(M, "create", { var newObject = Object.create(typeof aPrototype === "undefined" ? this : aPrototype); - if (typeof newObject.didCreate === "function") { - newObject.didCreate(); - } - if (newObject._dependenciesForProperty) { newObject._dependencyListeners = {}; } + if (typeof newObject.didCreate === "function") { + newObject.didCreate(); + } + return newObject; } else { var result = Object.create(aPrototype); @@ -713,13 +713,17 @@ if (!Object.seal) { */ Object.defineProperty(M, "callDelegateMethod", { value: function(name) { - var delegate, delegateFunctionName, delegateFunction; + var delegate = this.delegate, delegateFunctionName, delegateFunction; if (typeof this.identifier === "string") { delegateFunctionName = this.identifier + name.toCapitalized(); - } else { - delegateFunctionName = name; + if (delegate && typeof (delegateFunction = delegate[delegateFunctionName]) === "function") { + // remove first argument + Array.prototype.shift.call(arguments); + return delegateFunction.apply(delegate, arguments); + } } - if ((delegate = this.delegate) && typeof (delegateFunction = delegate[delegateFunctionName]) === "function") { + + if (delegate && typeof (delegateFunction = delegate[name]) === "function") { // remove first argument Array.prototype.shift.call(arguments); return delegateFunction.apply(delegate, arguments); -- cgit v1.2.3