O'Reilly logo

Google Maps JavaScript API Cookbook by Balkan Uraz, Alper Dincer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating your own events

Events are very important for JavaScript programming, and all JavaScript frameworks and APIs give developers access to some predefined event types related to their classes. The Google Maps JavaScript API is doing the same, and it gives us the most used event types with their classes. But what if you need a custom event type?

The Google Maps JavaScript API has a base class named google.maps.MVCObject that is the top class that most of the classes inherit. The class is ready for using in custom events with the google.maps.event namespace.

In this recipe, we will create a custom object with the google.maps.MVCObject class and bind it to a custom event to create your own events. The usage of the custom event cannot be a real-world ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required