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?<div><div><br></div>
<div>This would make stuff like this possible:</div><div><br></div><div>var map = $('#foo').mapQuery({</div><div> layers: layers,</div><div> listeners: {</div><div> 'mqAddLayer': function() {}</div><div>
},</div><div> /* ... */</div><div>});</div><div><br></div><div>(I'd prefer to have the listeners in an hash...)</div><div><br></div><div>Now I have to do</div><div><br></div><div>var map = $('#foo).mapQuery({</div>
<div> /* ... */</div><div>});</div><div>map.events.bind('mqLayerAdd', function() {});</div><div>map.layers(layers);</div><div><br></div><div>Would it hurt?</div><div><br></div><div>Cheers,</div><div> C</div><div>
<div><br></div><div><div class="gmail_quote">On Wed, Mar 7, 2012 at 11:29 AM, Volker Mische <span dir="ltr"><<a href="mailto:volker.mische@gmail.com">volker.mische@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 03/07/2012 10:20 AM, Christian Wygoda wrote:<br>
> Hi,<br>
><br>
> I am contemplating the idea of passing event listeners to the map options...<br>
> Then one could pass a listener for the mqLayerAdd event plus layers in<br>
> the map options.<br>
><br>
> Does that sound reasonable?<br>
><br>
> Cheers,<br>
> C<br>
<br>
</div></div>I currently work on the event handling (every evening atm, hence I'm<br>
getting somewhere).<br>
<br>
I haven't yet thought much about, how much things we put into the map<br>
options. But I think it would be nice, if it would be just JSON and not<br>
full JavaScript. This way you could easily get the options from some<br>
server. It's not JSON only atm IIRC, but we might want to change it?<br>
<br>
What is the reason to put it into the initialisation?<br>
<br>
I think it's simpler and also more expressive if you do it with some<br>
binds after the map was initialised. Rather than having one big<br>
configuration thing.<br>
<br>
Cheers,<br>
Volker<br>
</blockquote></div><br></div></div></div>