can.apply
How to apply a List-like as the arguments to a call of the function.
@@can.apply( obj, args )
The can.apply
symbol points to a Function or callable object's apply function, which converts an ArrayLike of arguments into the positional parameters and calls the function with them.
Parameters
- obj
{Object}
:the object to call the function on as the bound element
- args
{ArrayLike}
:The list of arguments to pass to the function
function func(c) { return c.process(); }; // Handle non-native lists or even non-list-likes being passed in obj[canSymbol.for('can.apply')] = function(ctx, list) { list = list.serialize ? list.serialize() : list; if(!list[canSymbol.for('can.isListLike')]) { list = [list]; } return Function.prototype.apply.call(this, ctx, list); };