I am struggling with wrapping some parts of a JavaScript library in order to use it with the JavaScript backend in Nim. Examples that I have found don't seem to match my scenario. Is this bit of JavaScript code clear enough that someone could get me started in the right direction?
I first set an access token with the accessToken function which takes a string argument.
Then create an object with the new operator and pass an object as the argument to the constructor. At least I think that's what is happening on the second line.
Then I create an on click event.
mapboxgl.accessToken = "my-token";
var map = new mapboxgl.Map( { container: "map" } );
map.on('click', function(event) { } );
Another thing that I am doing in my current JavaScript code is dynamically adding a property to the map object for convenience like so:
map.markers = [];
Could I do this with Nim as well?