Forums > Javascript

arguments.callee.task

August 17, 2006 | 7:32 pm

Hi,

If you want to access the Task from within a function, is there a reason
why should you use the syntax arguments.callee.task, rather than using
the variable name you assigned to the Task object?

For example, is there a difference between the first and the second example?

// example 1
var tsk = new Task(mytask, this);
function mytask
{
arguments.callee.task.cancel();
}

// example 2:
var tsk2 = new Task(mytask2, this);
function mytask2
{
tsk2.cancel();
}


Marco


November 30, 2011 | 12:47 pm

Came across this while looking for something else. In case anyone cares:

Example 2 won’t work if you use an anonymous function.

var tsktsk = new Task(function() { post("this function is has no namen"); });

I believe this functionality is mentioned in the documentation without a concrete example.


Viewing 2 posts - 1 through 2 (of 2 total)