Created
June 22, 2012 19:08
-
-
Save brihogan/2974559 to your computer and use it in GitHub Desktop.
CoffeeScript: Starter class with class, instance, and private methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ClassName | |
constructor: (attr) -> | |
@attr = attr | |
# Private | |
privateVariable = null | |
privateMethod = () -> | |
# Class method | |
@classMethod : () -> | |
# Instance method | |
instanceMethod : () -> | |
# to access class methods from within an instance | |
@construtor.classMethod() | |
# to find name of constructor | |
@construtor.name # does not work in IE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment