Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6928751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:13:46+00:00 2026-05-27T11:13:46+00:00

I am trying to add an idle listener to google maps. Problem: When I

  • 0

I am trying to add an idle listener to google maps.

Problem: When I added the listener as shown below, I get the error Cannot read property '__e3_' of undefined

JS Code

google.maps.event.addListener(map, 'idle', function() {
            console.log('hello');
}

I solved it by adding a setTimeout(..., 1000), to make sure the map is loaded after a sec.

Question:

  1. Is the error due to the map not being loaded?
  2. Is this the best way to solve it?
  3. Is this problem supposed to occur? I am guessing that if I added this same listener to map without other code, this error will not popup.

EDIT

Initialization of Map

<script type="text/javascript">
var map;
var geocoder;
var directionsService = new google.maps.DirectionsService();

function initialize() {
    var center_latlng = new google.maps.LatLng(42.354183,-71.065063);
    var options = {
        zoom: 15,
        minZoom: 11,
        maxZoom: 19,
        center: center_latlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById("map_canvas"), options);

    var Style = [
      {
        featureType: "poi",
        elementType: "labels",
        stylers: [
          { visibility: "off" }
        ]
      },{
        featureType: "landscape",
        elementType: "labels",
        stylers: [
          { visibility: "off" }
        ]
      }
    ]
    map.setOptions({styles: Style});

    geocoder = new google.maps.Geocoder();

    // Marker Clusterer
    var styles = {styles: [{
                        height: 34,
                        url: "images/template/markers/cluster.png",
                        width: 34,
                        textColor: '#FFF',
                        textSize: 12
                    },
                    {
                        height: 56,
                        url: "http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m2.png",
                        width: 56
                    },
                    {
                        height: 66,
                        url: "http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m3.png",
                        width: 66
                    },
                    {
                        height: 78,
                        url: "http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m4.png",
                        width: 78
                    },
                    {
                        height: 90,
                        url: "http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m5.png",
                        width: 90
                    }]
                };
    var mcOptions = {gridSize: 50, maxZoom: 15,  styles: styles['styles']};
    mc = new MarkerClusterer(map, [], mcOptions);

}
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:13:47+00:00Added an answer on May 27, 2026 at 11:13 am

    1.) Not exactly, This type of error is occurring because you are trying to access an object that doesn’t exist at the time you try to attach the listener. The listener code must be attached after the map variable contains the Google map object. When are you trying to attach the listener? I do not see it in the initialization code.

    2.) No, timeouts are not reliable. If there is a delay in the initialization the map object may still not be initialized at the specified interval.

    3.) You can not access properties of an object that doesn’t exist. Adding the listener in the init method after the map object is instantiated will solve this problem.

    var map;
    
    function initialize() {
        var center_latlng = new google.maps.LatLng(42.354183, -71.065063);
    
        var options = {
            zoom: 15,
            minZoom: 11,
            maxZoom: 19,
            center: center_latlng,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
    
        //instantiate map object
        map = new google.maps.Map(document.getElementById("map_canvas"), options);
    
        //attach listener to the map object.
        google.maps.event.addListener(map, 'idle', function() {
            console.log('hello');
        });
    }
    

    here is a working fiddle with the above code: http://jsfiddle.net/R7d6L/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying add roles to a drop dropdown box but im getting the error
Trying to add a new element to the DOM but I get all sorts
I'm trying add data triggers to the default combobox style so each text item
I am trying add picture boxes dynamically. My code is as PictureBox picture =
Im new to asp.net mvc. I'm trying add new model class but it got
Trying to add init parameter names to a list in init(ServletConfig) method. public void
Trying to add a blank sample app for a rails tutorial to GitHub, but
Trying to add a 'box' to a form at design time, I looked up
Trying to add email notification to my app in the cleanest way possible. When
Trying to add tests to the gobject-introspection test suite to cover more of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.