[Laszlo-dev] Idle callbacks are the devil's tools!
dhopkins at DonHopkins.com
Tue Jun 7 17:15:12 PDT 2005
Am I doing this wrong, or is there a bug in LzIdle.callOnIdle?
When you run the following code (enclosed), the foobar method doesn't
The documentation for callOnIdle is worded strangely. It says:
Calls the given delegate at the next idle event. This can be used for a
non- recursive callback.
Shouldn't that be "non-repeating"? (I don't think "recursive" is the
right word to describe a repeating callback.) The documentation should
be explicit about the fact that the delegate is called only once, and
then unregistered. (And the behavior of the code should match the
To work around this problem, I'm just registering an LzIdle.onidle
callback, and unregistering it when it happens. I want to defer some
layout processing until after all replication has happened. But
unfortunately the replication seems to be happening via onidle
processing too, so we're both waiting in the same line, and it calls my
lazy layout callback before all the replication is finished.
Is there a way to register a lower priority onidle callback that will
only run once all the pending replication and instantiation is finished?
I'd like for my idle callback to go to the end of the line each time
If I unregister and reregister my onidle callback (instead of checking
to see if I'm already registered and not doing anything in that case,
keeping my place in line) will my delegate go to the end of the line
behind any pending replication callbacks? But that would require more
processing, so I'd prefer a lazier way to be lazy.
I am considering using a timer instead, but that would introduce an
unnecessary delay, and it still might fire too early.
It would be nice to have a reallyidle event that gets fired when the
idle queue is empty.
<attribute name="del" value="null"/>
this.del = new LzDelegate(this, 'foobar');
Debug.write("calling LzIdle.callOnIdle", this.del);
<method event="foobar" args="args"><![CDATA[
Debug.write("foobar should be called, but isn't...", args,
More information about the Laszlo-dev