eschwartz / backbone.googlemaps

A Backbone JS extension for interacting with the Google Maps API (v3.10)
MIT License
139 stars 55 forks source link

Add Events and Normalize on-Prototype Event Callbacks #15

Closed mcordingley closed 10 years ago

mcordingley commented 10 years ago

Hi again,

I normalized all of the event callbacks that exist directly on an object. It seems that most plug-ins have standardized on "onEventName" as the callback name pattern. The "before" events were all missing the "on" part.

I also updated your views to trigger full events on at those points in time, so multiple interested parties can be notified when something renders or closes.

Cheers, Michael

eschwartz commented 10 years ago

Thanks, @mcordingley.

I'm a little concerned about renaming the event hooks (beforeXYZ --> onBeforeXYZ). Based on what I've seen in the wild, you're probably right that this is a preferred naming standard. I'm just not sure how many people are using these hooks, and I don't want to mess up anyone's code if I don't have to.

I know this is something bigger libraries deal with all the time. Any thoughts on the matter?

I merged the rest of the commit: f9e541c4068187fde615a2403601054b45856022

mcordingley commented 10 years ago

One thought is to have them both, in parallel, but the older format marked as deprecated. Release like this once and then remove the older format for the following release. This would give users a window in which to transition over.

You could also just mark them as deprecated and remove them entirely after another release, since there are true events being triggered now. I'm not personally as big of a fan of this option as of the other one, though. It really is convenient to have such in-object functions get automatically called.

mcordingley commented 10 years ago

One other thought is to simply leave it as-is and see if anyone complains. ;)