[Cartoweb-dev] initialising js plugins
Pierre GIRAUD
pierre.giraud at camptocamp.com
Wed Jul 18 09:01:32 EDT 2007
Actually, this sounds really interesting and you're patch seems correct.
We'll have a deeper look but it's likely we'll apply it soon.
Regards
Pierre
Frederic Back wrote:
> Hello,
>
> I am currently developing a plugin that uses ajax, and I'd like the js
> object to be initialised at startup.
>
> Currently, plugins like the tooltips or the location plugin get
> initialised manually in the init method of AjaxPlugins.js.
>
> To solve this, I extended the AjaxPlugins class to allow other plugins
> to register themselves to be triggered during startup. A patch against
> current HEAD should be attached to this email.
>
> Custom plugins can now registering themselves by appending themselves to
> the initialisation list during startup, ie. like this:
>
> AjaxPlugins.initializablePlugins.push(AjaxPlugins.MyCustomPlugin);
>
> Cheers,
> Fred
>
>
> ------------------------------------------------------------------------
>
> ? AjaxPlugins_customInit.patch
> Index: AjaxPlugins.js
> ===================================================================
> RCS file: /var/lib/cvs/public/cartoweb3/htdocs/js/AjaxPlugins.js,v
> retrieving revision 1.10
> diff -r1.10 AjaxPlugins.js
> 45a46,47
>
>> AjaxPlugins.initializablePlugins = new Array();
>>
>>
> 67a70,77
>
>> for( var i = 0; i < AjaxPlugins.initializablePlugins.length; i++ ) {
>> var plugin = AjaxPlugins.initializablePlugins[i];
>> if (typeof plugin.init != 'undefined') {
>> plugin.init();
>> }
>> }
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Cartoweb-dev mailing list
>> Cartoweb-dev at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/cartoweb-dev
>>
--
_________________________________________________________
Pierre GIRAUD
Géomaticien, Analyste
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel : 00 33 4 79 44 44 93
Mail : pierre.giraud at camptocamp.com
http://www.camptocamp.com
More information about the Cartoweb-dev
mailing list