runAsTask
Return a function that when called, adds a task that can be logged by logStack.
queues.runAsTask( fn [, makeReasonLog] )
This is useful for debugging.
import {queues} from "can";
var task = queues.runAsTask(function myTask(){
queues.logStack()
}, function(){
return ["myTask called on", this, "with",arguments];
});
task();
In production, runAsTask
simply returns the fn
argument.
Parameters
- fn
{function}
:A function that will be called by the returned function.
- makeReasonLog
{function}
:A function that will be called with the same
this
and arguments that the returned function was called with.
Returns
{function}
:
A function that calls fn
.