#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: |
Description
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; setTimeout(function(){ callback.apply(context, args); },interval); return true; // Boolean } var test = false; function func() { return dojo.doLater(test, this, 1000, 1.2); }
Attachments (1)
Change History (7)
comment:1 Changed 13 years ago by
Owner: | changed from Adam Peller to Mike Wilcox |
---|
comment:2 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 Changed 13 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Changed 13 years ago by
Attachment: | decay.patch added |
---|
comment:5 Changed 13 years ago by
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
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
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.
(In [16619]) Fixes #8596 - Added Adam's decay parameter to slow (or speed up) the polling.