I have tried standard way:
class MyMap extends google.maps.Map
constructor: (mapDiv, opts)->
super(mapDiv, opts)
But in this case placeholder was empty.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This problem is a combo of the way CoffeeScript makes classes and the way that the Google Maps Javascript API is written/obfuscated/minified.
When CoffeeScript extends a class, it creates code something similar to this:
In most cases, and especially in cases where the “extendee” was written in CoffeeScript, this works great.
But in the case of google.map.Maps there is (I suspect) a whole bunch of scope manipulation going on and it’s kindof undoing the scope CoffeeScript tries to set. Admittedly this is a guess.
So in this case it’s time to put on ye olde JavaScript hat and just do some plain old scope-locking on the constructor. So drop your
superandapplythe function in the scope of the class with a line of JavaScript. CoffeeScript will just wave, smile, and output the JavaScript line as is.Make sense?