HERE Maps JS API v3: `onceEventListener` method bug

126 views Asked by At

I need to use onceEventListener method from an instance of H.Map as documented here, but instead it threw me an error saying that Uncaught TypeError: map.onceEventListener is not a function. What could be wrong?

Fiddle here.

2

There are 2 answers

2
Jithin Krishnan On BEST ANSWER

Seems to be a bug in the API, try using addEventListner and removeEvent Listner as a work around

map.addEventListener('tap', event1, false);
  var event1=function (evt) {
         console.log("executing listner 1");
        map.removeEventListener('tap', event1);
  }
0
Anurag Baddam On

This does indeed seem to be a bug with our APIs. For now, the work around is a good idea, and I have notified the MAPJS team so they can look into the issue. Thanks.