[MapQuery] Make it possible to add event listeners to the map options?

Christian Wygoda arsgeografica at googlemail.com
Wed Mar 7 05:49:51 EST 2012


One can easily ship around this, but I'm used to give my listeners as part
of the options from both OpenLayers as well as jQuery. And as long as one
does not add listeners, i'd still be JSON, right?

This would make stuff like this possible:

var map = $('#foo').mapQuery({
  layers: layers,
  listeners: {
    'mqAddLayer': function() {}
  },
  /* ... */
});

(I'd prefer to have the listeners in an hash...)

Now I have to do

var map = $('#foo).mapQuery({
  /* ... */
});
map.events.bind('mqLayerAdd', function() {});
map.layers(layers);

Would it hurt?

Cheers,
  C

On Wed, Mar 7, 2012 at 11:29 AM, Volker Mische <volker.mische at gmail.com>wrote:

> On 03/07/2012 10:20 AM, Christian Wygoda wrote:
> > Hi,
> >
> > I am contemplating the idea of passing event listeners to the map
> options...
> > Then one could pass a listener for the mqLayerAdd event plus layers in
> > the map options.
> >
> > Does that sound reasonable?
> >
> > Cheers,
> >   C
>
> I currently work on the event handling (every evening atm, hence I'm
> getting somewhere).
>
> I haven't yet thought much about, how much things we put into the map
> options. But I think it would be nice, if it would be just JSON and not
> full JavaScript. This way you could easily get the options from some
> server. It's not JSON only atm IIRC, but we might want to change it?
>
> What is the reason to put it into the initialisation?
>
> I think it's simpler and also more expressive if you do it with some
> binds after the map was initialised. Rather than having one big
> configuration thing.
>
> Cheers,
>  Volker
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapquery/attachments/20120307/a67c2863/attachment.html


More information about the MapQuery mailing list