[geojquery] Desireable plugin pattern
Volker Mische
volker.mische at gmail.com
Thu Jul 29 17:30:36 EDT 2010
Best thing is to read the archive, there are so many ways :)
IIRC, my last preferred approach was to have distinction between the map
and layers (and perhaps even features). So that you e.g. can bind events
to the map, layers and features.
As I always say, we are still in flux, please write code if you've the
time to and do it the way you like. It's much better to comment on
existing things, rather than discussion vaporware to death.
Cheers,
Volker
On 29.07.2010 22:14, Christian Wygoda wrote:
> I understand not wanting to have DOM objects returned (which jQuery UI
> doesn't if the called function returns anything (other than "this")).
> Personally I could live with using the jQuery UI approach of having the
> first arg as function name and then the real function arguments - at
> least it keeps the jQuery namespace clean.
>
> What would you like to see instead of
>
> $('#mymap').map('addLayer', LayerDefObject);
> $('#mymap').map('getNumLayers')
>
> I'd be happy to learn what you envision!
>
> Cheers,
> Crischan
>
> On Thu, Jul 29, 2010 at 9:53 PM, Volker Mische <volker.mische at gmail.com
> <mailto:volker.mische at gmail.com>> wrote:
>
> On 29.07.2010 21:44, Christian Wygoda wrote:
>
> Hi folks,
>
> I was looking at the available code examples offered on the
> mailing list
> and keeping in mind that there will be a Core plugin and UI
> plugins I
> came to the question which plugin pattern should be embraced.
>
> I think for the UI plugins it will be the natural to use the
> jQuery UI
> widget factory.
> For the Core plugin we would like to stay clean of jQuery UI
> dependencies, right? So we need to write our own plugin. But
> maybe we
> should use the same pattern as the jQuery UI widget factory?
> This could
> have two advantages:
>
> First, any project using the full set of GeoJQuery Core & UI
> magic could
> reuse the jQuery UI widget factory to build the core plugin and thus
> remove some lines of "redundant" code.
> Secondly, using the same pattern would make life a little bit
> easier for
> folks hacking both in Core & UI.
>
> To get our feet wet we could even start using the jQUery UI widget
> factory now (!) for the Core plugin and later "write" (a.k.a.
> c&p) the
> dropin for the widget factory. Or just point to the
> jquery.ui.widget.js
> in the install instructions then - depending on how lazy we will
> be. ;)
>
> Let me hear your thoughts.
>
> Cheers,
> Crischan
>
>
> Hi,
>
> the core system should use something like the jQuery UI widget
> factory, but in my opinion not exactly the same. I don't like the
> way way jQuery UI uses the first argument as function name, and the
> the rest as parameters. For jQuery UI it makes sense to always
> return a DOM object, for geojquery it doesn not.
>
> geojquery is not about DOM manipulation it is about maps.
>
> Cheers,
> Volker
>
>
More information about the Geojquery
mailing list