[MapQuery] Return value of Layer.remove()

Volker Mische volker.mische at gmail.com
Sun Feb 26 18:47:18 EST 2012


Hi all,

I currently work on the event handling a bit and I stumbled upon the
Layer.remove() function. According to the docs, it returns the ID of the
layer (the implementation doesn't, but that would be easy to fix).

Though I don't think this makes much sense. But what are the
alternatives? For the "removelayer" event, I've gone for including the
just removed layer in the event. This is also what OpenLayers does. It
makes sense, as you can now use its data to so some cleanup in your
application.

A good return value is a harder problem. Returning the removed layer
doesn't make much sense, as we want some kind of chaining. It would be
odd to have a chain with a non-attached layer.

Another possible value would be the Map object, so you can keep the
chain and e.g. add a new layer.

What do you think?

Cheers,
  Volker


More information about the MapQuery mailing list