0

This may not be the best place for this question but here goes:

I'm a beginner in googlemaps and javascript and found this example for something I'm working on. http://search.missouristate.edu/map/mobile/examples/ZoomPanControl.htm I understand most of the code but I'm having a hard time finding out the meaning of the following lines of code at the end of this file ZoomPanControl.js

window["missouristate"] = window["missouristate"] || {};
window["missouristate"]["web"] = window["missouristate"]["web"] || {};
window["missouristate"]["web"]["ZoomPanControl"] = ZoomPanControl;

Edit: The original example is no longer available and redirects to a map that doesn't have the custom ZoomPanControl, here is an example that shows the custom zoom/pan control referenced

4

1 回答 1

0

它将控件附加到全局变量(或命名空间?)“窗口”,以便您可以使用以下方法实例化它:

 var ZoomPanControl = new missouristate.web.ZoomPanControl(map);

Google Maps API 加载器做同样的事情,即:

window.google = window.google || {};
google.maps = google.maps || {};
于 2012-08-28T07:26:08.453 回答