[geojquery] To plug in or not to plug in?

Eric Lemoine eric.lemoine at camptocamp.com
Sun Mar 14 09:26:14 EDT 2010


On Sunday, March 14, 2010, Oliver Tonnhofer <olt at bogosoft.com> wrote:
>
> On 13.03.2010, at 21:48, Volker Mische wrote:
>> the way I have imagined it is like gquery does it. Once you apply the
>> map object, you are not in the DOM world any more. Any future call in
>> the chain will be applied to the map. Here's an example:
>>
>> $('#map').map({someoptions}).center(lonlat);
>> [...]
>> $('#map').map({someoptions}).center(lonlat).dom().hide();
>
>
> Ok, that looks not to bad.

Agreed.

Either manipulating the DOM is favored and the map method returns a
jQuery object. And the map object is made available through a specific
method (e.g. data("map")).

Or acting on the map is favored and the map method returns a map
object. In this case it is the jQuery object that is made available
through a specific method (e.g. dom()).

I don't know which I'd favor at this point, but both approaches make
sense to me.

> How do you think we retrieve the map object again later? We could store the object with .data() and return this object on subsequent .map() calls.
>
> $('#map').map({someoptions})
> // later
> $('#map').map().center(lonlat);

But shouldn't calling map() again create a new map object?

I think geojquery should mimic other pkugins wrt that. For example
what does happen when jQuery UI's accordion() method is called twice?
Cheers,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


More information about the Geojquery mailing list