title: Openlayer's drawstart event firing multiple times after drawend occur
body: <p>I'm editing the <a href="https://openlayers.org/en/latest/examples/measure.html" rel="nofollow noreferrer">measure</a> function made available by OpenLayers team, but I facing some problem. I added an option to remove the last added point when the user right click during the <code>drawstart</code> event, but after the first draw is finished this option is fired multiple times. If I finish 3 drawings this option is fired 3 times and so on.</p>
  
  <p>I'm using <code>addEventListener('contextmenu')</code> to fire the right click event, so I tried to follow <a href="https://developers.google.com/web/updates/2016/10/addeventlistener-once" rel="nofollow noreferrer">this suggestion</a> and add a <code>{once: true}</code> option, but this didn't work. I also tried to add this option as a listener and on <code>drawend</code> event remove the listener using <a href="https://openlayers.org/en/latest/apidoc/module-ol_Observable.html" rel="nofollow noreferrer"><code>unByKey()</code></a>, but this didn't worked either.</p>
  
  <p>I just can't understand why the <code>drawstart</code> event is being fired multiple times.</p>
  
  <p><strong>My code</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>let listener;
  draw.on('drawstart', (evt) =&gt; {
      // set sketch
      sketch = evt.feature;
  
      let tooltipCoord = evt.coordinate;
  
      listener = sketch.getGeometry().on('change', (evt) =&gt; {
          let geom = evt.target;
          let output;
          if (geom instanceof Polygon) {
              output = formatArea(geom);
              tooltipCoord = geom.getInteriorPoint().getCoordinates();
          } else if (geom instanceof LineString) {
              output = formatLength(geom);
              tooltipCoord = geom.getLastCoordinate();
          }
          measureTooltipElement.innerHTML = output;
          measureTooltip.setPosition(tooltipCoord);
      });
  
      // Remove last vector with right click
      this.map.getViewport().addEventListener('contextmenu', (evt) =&gt; {
          console.log("right clicked");
          evt.preventDefault();
          draw.removeLastPoint()
      });
  });
  </code></pre>