Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#8596 closed enhancement (wontfix)

dojo.doLater: add optional decay param

Reported by: Les Owned by: Mike Wilcox
Priority: high Milestone: tbd
Component: Dojox Version: 1.2.3
Keywords: Cc:
Blocked By: Blocking:


The code below could have some problems, but I was trying to add an optional decay parameter as an enhancement.

dojo.doLater = function(/*anything*/conditional,/*Object ?*/context, /* Number ? */interval, /* Number ? */decay){
	if(conditional){ return false; }  // Boolean
	var callback = dojo.doLater.caller,
			args = dojo.doLater.caller.arguments;

        decay = decay || 1;
        interval = interval || 100;
	interval = callback._decay ? interval * callback._decay : interval;
	context = context || window;
        callback._decay = callback._decay ? callback._decay * decay : decay;
		callback.apply(context, args);
	return true; // Boolean

var test = false;

function func() {
   return dojo.doLater(test, this, 1000, 1.2);

Attachments (1)

decay.patch (4.7 KB) - added by dante 13 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 13 years ago by Adam Peller

Owner: changed from Adam Peller to Mike Wilcox

comment:2 Changed 13 years ago by Mike Wilcox

Resolution: fixed
Status: newclosed

(In [16619]) Fixes #8596 - Added Adam's decay parameter to slow (or speed up) the polling.

comment:3 Changed 13 years ago by Adam Peller

Resolution: fixed
Status: closedreopened

comment:4 Changed 13 years ago by Les

I just faxed in the CLA.

Changed 13 years ago by dante

Attachment: decay.patch added

comment:5 Changed 13 years ago by Mike Wilcox

Resolution: wontfix
Status: reopenedclosed

After some consideration, I'm going to not apply this patch - at least not for the time being.

doLater is actually designed to be very basic. It's for prototyping, and for beginners who don't want to wrestle with deferreds and an advanced connection policy. For example, I'm using it in the first version of FLAudio, but plan to factor it out for something that fires immediately when the object is available.

So let's see how this works for the time being, and maybe we'll find the patch is necessary.

And Les, I'm glad this got you to file a CLA! It will be useful.

comment:6 Changed 13 years ago by Adam Peller

Mike, you may want to consider at least a timeout arg, though (next release, perhaps) maybe with a default. Otherwise, you could imagine a lot of runaway timers.

Note: See TracTickets for help on using tickets.