Stack Exchange
Call methods from closures functions
I have a CoffeeScript class:
class window.MapHandler
    map = null

    makeMap: () ->
        latlng = new google.maps.LatLng(54.711929,20.5089);
        myOptions =
            zoom: 12
            center: latlng
            mapTypeId: google.maps.MapTypeId.ROADMAP
        map = new google.maps.Map(document.getElementById("map_canvas"), myOptions)
        @geocode("Калининград, Чернышевского 101")


    placeMarker: (location) ->
        marker = new google.maps.Marker(
            position: location
            map: @map)

    geocode: (address) ->
        geocoder = new google.maps.Geocoder
        geocoder.geocode(
            'address': address,
            (results, status) -> 
                if status is google.maps.GeocoderStatus.OK
                    map.setCenter(results[0].geometry.location)
                    @placeMarker(results[0].geometry.location)
                else alert("Geocode was not successful for the following reason: " + status);
        )

There is a problem, when I call placeMarker method from anonymous function from geocode method: visualizer.js:37Uncaught TypeError: Object [object DOMWindow] has no method 'placeMarker'
How can I call this method?

geocode: (address) ->
    geocoder = new google.maps.Geocoder
    geocoder.geocode(
        'address': address,
        (results, status) => 
            if status is google.maps.GeocoderStatus.OK
                map.setCenter(results[0].geometry.location)
                @placeMarker(results[0].geometry.location)
            else alert("Geocode was not successful for the following reason: " + status);
    )

Note the fat arrow in line 5 - it preserves this and @ inside the closure.
