funName = () ->
$(\".foo\").addClass(\"bar\");
Compiles into the scope of an anonymous function. Calling funName
from the console res
I know this may be an older thread, but I've encountered the same problem and noticed an interesting command you can add into the compiler enviroment to fix this problem.
The command -b or --bare is used to compile the JavaScript without the top-level function safety wrapper. After I added that command when I compiled my CoffeeScript file, it removed that odd wrapper:
(function() {
var funName;
funName = function() {
return $(".foo").addClass("bar");
};
}).call(this);
I use WebStorm as my IDE enviroment and this is my compiler statement I use:
--compile --bare $FileName$