I'm using Mapbox GL and the doc states:
Adds a listener to a specified event type.
Parameters:
type(string) The event type to add a listen for.
listener(Function) The function to be called when the event is fired. The listener function is called with the data object passed to fire , extended with target and type properties.
Source: https://www.mapbox.com/mapbox-gl-js/api/#evented#on
So if I do:
map.on('click', 'somelayer', { customData: 'foo' }, customFunction);
I get an error:
Uncaught TypeError: i.call is not a function
What am I doing wrong?