Advanced GIS

In-class Exercise: JavaScript

Part 1: Listening for Leaflet events

  1. Remix this Glitch project into your Glitch account.
  2. In the JavaScript, listen for more map events and log out the name of the event. For example, copy
    map.on('moveend', function () {
      console.log('moveend');
    });
    paste those lines (so the moveend listener still exists) and change moveend in the new listener, like this:
    map.on('click', function () {
      console.log('click');
    });
    Don't forget to change what is logged out, too, so you can see which event happened.
  3. Do the above process until you have three different map events. Pay special attention to:
    • click
    • dblclick
    • mousedown
    • mouseup
    • move
    How do the above events differ from each other?