[OpenLayers-Users] Understanding events

Stephen Woodbridge woodbri at swoodbridge.com
Tue Dec 8 17:26:26 EST 2009


Yves Moisan wrote:
>> Try calling your select function using a timer delay from loadend event. 
> 
> I tried looking for examples.  I saw the obvious controls for which a
> delay makes sense (hover, WMSGetFeatureInfo) but I didn't find a way to
> set a delay in some arbitrary location in the code.  setTimer, timer ?

Wrap your selectFeature() in a setTimer()

> However, it pretty much defeats the purpose of waiting for loadend if
> one adds a delay on top of it.

Yes and no, it gets you closer to the time that you need so there less 
likely going to be a problem with you setting a delay, that may get 
impacted by a garbage collection of some other thing making the 
sensitivity of when you can fire the selectFeature.

Maybe is doesn't help, but try it and see if it solves the problem. 
Maybe someone needs to file a bug against the loadend event.

I don't like the answer, but if is works you have another data point 
that might lead someone to fix the problem once and for all. ;)

-Steve

> Thanx,
> 
> Yves
> 
>> I have found that sometimes events fire but the thread adding stuff to 
>> the DOM or something like that has not completed yet and adding a 
>> 30-50ms delay before calling my code solved the problem.
>>
>> Yeah, I know it ugly, but give it a try and see if it helps.
>>
>> -Steve W
> 




More information about the Users mailing list