सूचना: Google Maps Platform में, बेसमैप की नई स्टाइल जल्द ही उपलब्ध होगी. मैप की स्टाइल में किए गए इस अपडेट में, नया डिफ़ॉल्ट कलर पैलेट, आधुनिक पिन, और मैप के अनुभव और इस्तेमाल में सुधार शामिल हैं. मार्च 2025 में, सभी मैप स्टाइल अपने-आप अपडेट हो जाएंगे. उपलब्धता और पहले से ऑप्ट-इन करने के तरीके के बारे में ज़्यादा जानने के लिए, Google Maps Platform के लिए नया मैप स्टाइल लेख पढ़ें.
Google Maps JavaScript API के साथ असाइनिश्मन वाले तरीके का इस्तेमाल करने के लिए, प्रॉमिस का इस्तेमाल करने से जुड़ी यह गाइड देखें या नीचे दिए गए उदाहरण देखें.
एक साथ काम नहीं करने वाली प्रोसेस और await
await ऑपरेटर का इस्तेमाल, किसी Promise के पूरा होने का इंतज़ार करने के लिए किया जाता है. इसका इस्तेमाल सिर्फ़ किसी असाइनिक फ़ंक्शन में किया जा सकता है.
कॉलबैक पैटर्न अब भी मान्य है और इसका इस्तेमाल किया जा सकता है.
constelevationService=google.maps.ElevationService();constlocations=[{lat:27.986065,lng:86.922623}];constcallback=(results,status)=>{if(status==='OK'){console.log(results);}else{// handle this case}};elevationService.getElevationForLocation({locations},callback);
फ़िलहाल, Promises सिर्फ़ getPlacePredictions() में काम करते हैं. ↩
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2025-01-15 (UTC) को अपडेट किया गया."],[[["Asynchronous methods within the Google Maps JavaScript API predominantly return Promises for efficient handling of operations."],["Numerous Google Maps services, including Directions, Distance Matrix, Elevation, Geocoder, and Streetview, utilize Promises in their methods."],["Developers can employ async/await, then/catch/finally, or traditional callbacks to manage asynchronous operations and responses effectively."],["While Places generally do not utilize Promises, the `getPlacePredictions()` method within the Places AutocompleteService does offer partial Promise support."],["Beginning in 2020, all newly introduced APIs within the Google Maps JavaScript API exclusively support Promises for asynchronous operations."]]],[]]