@ and @@
This module provides an Ruby style aliases for:
thisin the form of@this.constructorin the form of@@
Example
Animal = (type, color) {
@type = type
@color = color
@@count += 1
@@all.push @
}
@ in bang function calls
In the case of unwrapped async calls via the bang postfix, @ will actually refer to the outer this.
Since we can refer to both via this method, binding becomes unecessary.
Example
Class.cacheData = {
d = $.get! "/"
@data = d // outer this
this.data = d // inner this
return @
}