Skip to content

Instantly share code, notes, and snippets.

@Satyam
Created May 29, 2012 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Satyam/2828145 to your computer and use it in GitHub Desktop.
Save Satyam/2828145 to your computer and use it in GitHub Desktop.
ac.done patch
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