I’m working with the new mapbox.js API, especially the event callback ‘panned’. The callback is fired about 50-100 times when the user moves the map, which is way too much. What’s the best way to get only the first and the last event (or only the last) out of this?
map.addCallback('panned', function(move) {
console.log('panned');
});
Use .setTimeout:
For the timeout time choose an appropriate time, which you have to find out by fiddling around with several values.