View Full Version : [CLOSED][4.0.1] Function in Ext.util.DelayedTask is not optional

7 Jun 2011, 11:05 AM
In the documentation it says:

DelayedTask( [Function fn], Object scope, [Array args] ) : void
The parameters to this constructor serve as defaults and are not required.

•fn : Function
(optional) The default function to call.

When I put the following lines in my program:

var task = new Ext.util.DelayedTask();

I get this error:

fn is undefined
fn.apply(sc0re, args || []);
on line 10309 ext-all-debug.js

When I change the code lines to:

var task = new Ext.util.DelayedTask(function() {});

it works.

Is the documentation wrong again? 'Cause, how can this pass unit testing?

7 Jun 2011, 2:40 PM
The function shouldn't be optional IMO. Why would you create an empty DelayedTask?

14 Jun 2011, 9:48 PM
It is optional.

The docs say:
For the constructor:
The default function to call

For the delay function:
Overrides function passed to constructor

So you either need to pass a function to the constructor, or to the delay function, or even both if you want. I don't see why you would think it was optional in both cases, considering the class description says:

The DelayedTask class provides a convenient way to "buffer" the execution of a method

Regardless, I've updated the constructor docs specifically to indicate that you must pass a function to the delay method if you don't pass one to the constructor.