Created
May 29, 2012 12:28
-
-
Save Satyam/2828145 to your computer and use it in GitHub Desktop.
ac.done patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ac.done = (function (original) { | |
return function (data, opts) { | |
opts = opts || {}; | |
var instance = ac.command.instance, | |
config = instance.config || {}, | |
action = instance.action, | |
children = config.children, | |
params = ac.params.getAll(), | |
me = this, | |
childOpts = opts.children || {}; | |
delete opts.children; | |
if (config.hasOwnProperty('child')) { | |
children = config.children = {child:config.child}; | |
delete config.child; | |
} | |
if (!children) { | |
return original.apply(this, arguments); | |
} | |
Y.each(children, function (child) { | |
child.action = child.action || action; | |
child.params = Y.merge(child.params, params); | |
Y.mix(child, opts, true, null, 0, true); | |
}); | |
Y.mix(children, childOpts, true, null, 0, true); | |
return ac.composite.execute(config, function (childData, meta) { | |
original.call(me, Y.merge(data, childData), meta); | |
}); | |
}; | |
})(ac.done); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment