[OpenLayers-Users] Understanding events
Yves Moisan
yves.moisan at boreal-is.com
Thu Dec 10 08:55:34 EST 2009
>
> I'm not sure I get it. Why don't you do the whole thing once the layer
> is loaded?
>
> layer.events.on({
> scope: layer,
> loadend: function() {
> // "this" references the layer
> var features = this.features;
> // do what you need with the features
> // ...
> }
> });
Yes I ended up doing something like this indeed.
>
> the loadend listener need not be anonymous, you can also go with:
>
> function onLoadend() {
> var features = this.features;
> }
> layer.events.on({
> scope: layer,
> loadend: onLoadend // you don't call the function here but just
> provide a reference to it
> });
>
> Hope this makes sense,
Are those equivalent :
layer.events.on({
scope: layer,
loadend: onLoadend
});
and
layers.events.register("loadend", layer, onLoadend)
Thanx !
Yves
More information about the Users
mailing list