The codes for Google Analytics use a global _gaq
object for the analytics commands. They advise to check if such an object already exists, like this:
var _gaq = _gaq || [];
// Command
_gaq.push(['_trackPageview']);
In CoffeeScript, this would look like this:
_gaq = _gaq or []
Which compiles to this:
(function() {
var _gaq;
_gaq = _gaq || [];
}).call(this);
How can I write a CoffeeScript code that will lead to the behaviour of the above Javascript?