apply
Call a callable, with a context object and a list of parameters
apply(func, context, args)
Call the callable func
as if it were a function, bound to context
and with any additional parameters
contained in the Array-like args
Note that func
must either be natively callable, implement @@can.apply,
or have a callable apply
property to work with canReflect.apply
var compute = canCompute("foo");
canReflect.apply(compute, null, ["bar"]);
canReflect.apply(compute, null, []); // -> "bar"
Parameters
- func
{function(...)}
:the function to call
- context
{Object}
:the context object to set as
this
on the function call - args
{*}
:arguments to be passed to the function call
Returns
{*}
:
return types and values are determined by the call to func