mapsplugin / cordova-plugin-googlemaps

Google Maps plugin for Cordova
Apache License 2.0
1.66k stars 913 forks source link

warning: google.maps.event.addDomListener() is deprecated, use the standard addEventListener() #2910

Open TreehouseNorris opened 1 year ago

TreehouseNorris commented 1 year ago

I'm submitting a ... (check one with "x")

OS: (check one with "x")

cordova information: (run $> cordova plugin list)

cordova-android-support-gradle-release 2.1.0 "cordova-android-support-gradle-release"
cordova-custom-config 5.1.0 "cordova-custom-config"
cordova-plugin-androidx-adapter 1.1.3 "cordova-plugin-androidx-adapter"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-appcenter-analytics 0.1.9 "App Center Analytics for Cordova"
cordova-plugin-appcenter-crashes 0.1.9 "App Center Crashes for Cordova"
cordova-plugin-appcenter-shared 0.1.9 "App Center shared code for Cordova"
cordova-plugin-camera-preview 0.10.0 "cordova-plugin-camera-preview"
cordova-plugin-camera 6.0.0 "Camera"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-dialogs 2.0.2 "Notification"
cordova-plugin-file-transfer 2.0.0-dev "File Transfer"
cordova-plugin-file 7.0.0 "File"
cordova-plugin-geolocation 4.0.2 "Geolocation"
cordova-plugin-inappbrowser 3.2.0 "InAppBrowser"
cordova-plugin-network-information 2.0.2 "Network Information"
cordova-plugin-screen-orientation 3.0.2 "Screen Orientation"
cordova-plugin-splashscreen 5.0.3 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-zip 3.1.0 "cordova-plugin-zip"
es6-promise-plugin 4.2.2 "Promise"

If you use @ionic-native/google-maps, please tell the package.json (only @ionic-native/core and @ionic-native/google-maps are fine mostly)

    "@angular/google-maps": "12.2.13",
    "@google/markerclustererplus": "^5.0.3",
    "@types/google.maps": "^3.49.2",
     "cordova-plugin-geolocation": "^4.0.2",

Current behavior: Generates 50 console.warn'ings when launching a map with markers on it. "google.maps.event.addDomListener() is deprecated, use the standard addEventListener() method instead: https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener The feature will continue to work and there is no plan to decommission it."

Expected behavior: No console warnings

Screen capture or video record: none

Related code, data or error log (please format your code or data):

// /plugins/cordova-plugin-googlemaps/src/browser/PluginMarker.js line 450
google.maps.event.addDomListener(container.parentNode.parentNode.parentNode, 'click', function() {
          self.onMarkerClickEvent(event.INFO_CLICK, marker);
        }, true);

// /plugins/cordova-plugin-googlemaps/src/browser/PluginStreetViewPanorama.js line 113
google.maps.event.addDomListener(container, 'click', function(evt) {
          var pov = panorama.getPov();
          var clickInfo = {
            'orientation': {
              'bearing': pov.heading,
              'tilt': pov.pitch
            },
            'point': [evt.clientX, evt.clientY]
          };
          if (self.__pgmId in plugin.google.maps) {
            plugin.google.maps[self.__pgmId]({
              'evtName': event.PANORAMA_CLICK,
              'callback': '_onPanoramaEvent',
              'args': [clickInfo]
            });
          }
        });

possible solution: https://stackoverflow.com/a/71990198/5858974