[OpenLayers-Dev] Map event confusion

Tim Schaub tschaub at opengeo.org
Fri Mar 26 12:49:21 EDT 2010


I'm in favor of removing this cruft as well.

To be clear, here are things that "work" currently:

     // myapp.js

     map.events.on({
         popupopen: myPopupOpenListener,
         // and the rest
     });

     var openPopup = function() {
         var pop = createPopup();  // defined elsewhere
         pop.show();
         map.events.triggerEvent("popupopen", {popup: pop});
     }

Currently, if application code makes use of the events listed below, the 
corresponding event listeners get called appropriately.

After removing these entries from the EVENT_TYPES array, these listeners 
will not get called.

Again, I'm fine with this.  Just wanted to be clear that we are changing 
the behavior of any applications that might be using these named events 
(perhaps none).

Tim


Marc Jansen wrote:
> Hi all,
> 
> so do you all think I should open up a ticket with milestone 2.10 
> including a patch that does
> 
>     * leave the events in the EVENT_TYPES array as they currently are
>     * but changes the documentation to not reference the events
>           o addmarker,
>           o removemarker,
>           o clearmarkers,
>           o dragstart,
>           o dragend,
>           o drag,
>           o popupopen,
>           o popupclose anymore?
>     * should I add yet another ticket to remove the unneeded events in 3.0?
> 
> What do you think? I am willing to provide a patch for the above ticket.
> 
> Regards and thanks for your opinions,
> Marc
> 
> 
> Stephen Woodbridge schrieb:
>> Christopher Schmidt wrote:
>>   
>>> On Thu, Mar 25, 2010 at 03:32:36PM -0600, Tim Schaub wrote:
>>>     
>>>> Marc Jansen wrote:
>>>>       
>>>>> Hi devs,
>>>>>
>>>>> I am rather confused about the documentation about map-events. Is it 
>>>>> right that
>>>>>
>>>>>     * addmarker,
>>>>>     * removemarker,
>>>>>     * clearmarkers,
>>>>>     * dragstart,
>>>>>     * dragend,
>>>>>     * drag
>>>>>
>>>>> are defined but never get triggered?
>>>>>
>>>>> If so, they should IMHO be removed from the EVENT_TYPES-array and the 
>>>>> documentation for that.
>>>>>
>>>>>         
>>>> The problem with removing things from the EVENT_TYPES array is that 
>>>> there could be applications that have subscribers for them and use 
>>>> map.events to publish.
>>>>
>>>> If we remove those entries, those applications break.
>>>>
>>>> I know this is silly.  You are right to point out that there is little 
>>>> sense and lots of confusion in having them.
>>>>
>>>> Our safest bet is to mark them as unused and remove them in 3.0.  If 
>>>> others think the caution is not needed, I wouldn't be opposed to 
>>>> removing them.
>>>>       
>>> In general, I'm supportive of any changes that make things simpler which
>>> means that applications that did not throw errorrs in earlier releases will
>>> continue to not throw errors in future releases. 
>>>
>>> In this particular case, it's hard to imagine that someone has written
>>> code that specifically registers for an event that doesn't do anything.
>>>
>>> With sufficient documentation, I'd be willing to change the code to not
>>> have those events. However,  since events (unlike methods) are not actually
>>> in existence in the Natural Docs except if they're documented, I think
>>> it would be equally successful -- for anyone who isn't actually digging
>>> into the code itself, a fact that describes more and more of our users --
>>> to just not document those events. At that point, the events simply
>>> 'disappear' from the docs completely without any other work on our
>>> part.
>>>
>>> -- Chris
>>>     
>> Chris, et al,
>>
>> I can appreciate this sentiment, I think there are a lot of "casual" 
>> users that will not dig into the code and in those cases, if it is not 
>> in the docs then the problem does indeed go away. But there are a small 
>> but healthy number of "coders" who are trying to do more with OpenLayers 
>> like Marc, myself and others I'm sure that do dig into the code and 
>> spend a lot of time chasing our tails, aka: learning? :) because we try 
>> something like an event that never gets triggered and then scratch our 
>> heads for a while trying to figure out why. We eventually do figure it 
>> out or ask and get help. I would like to see doc that better explains 
>> what events exist and what gets passed to them. I have also noticed that 
>> there is a trend to move away from callbacks, which were somewhat better 
>> documented, in favor of using events (or maybe I'm mistaken) and some 
>> objects say register for such and such event to get notified when 
>> something happens, but there is no additional information as to what is 
>> passed to the event, etc.
>>
>> Regardless, I'm loving OL and continued to be impressed by how much is 
>> built into OL and how easy OL is to extend once I can get my head to 
>> think about the problem in in the right way.
>>
>> Thanks all and best regards,
>>    -Steve
>>
>>   
>>>> Tim
>>>>
>>>>       
>>>>> Please ignore the mail if I missed something fundamental (but please 
>>>>> enlighten me where these events are triggered)
>>>>>
>>>>> Regards,
>>>>> Marc
>>>>>
>>>>> _______________________________________________
>>>>> Dev mailing list
>>>>> Dev at openlayers.org
>>>>> http://openlayers.org/mailman/listinfo/dev
>>>>>         
>>>> -- 
>>>> Tim Schaub
>>>> OpenGeo - http://opengeo.org
>>>> Expert service straight from the developers.
>>>> _______________________________________________
>>>> Dev mailing list
>>>> Dev at openlayers.org
>>>> http://openlayers.org/mailman/listinfo/dev
>>>>       
>> _______________________________________________
>> Dev mailing list
>> Dev at openlayers.org
>> http://openlayers.org/mailman/listinfo/dev
>>
>>   
> 
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev


-- 
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.



More information about the Dev mailing list