Created
August 7, 2012 06:43
-
-
Save simon-lang/3282432 to your computer and use it in GitHub Desktop.
Revealing Module Pattern in CoffeeScript
This file contains hidden or 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
| # Revealing Module Pattern | |
| # coffee -o lib/ -cwb src/ | |
| do ($ = jQuery.noConflict()) -> | |
| ProjectName = | |
| BaseModule: (module) -> | |
| $ -> | |
| if module.init | |
| module.init() | |
| ProjectName.MyModule = ProjectName.MyModule or ProjectName.BaseModule do () -> | |
| haveFun = -> | |
| console.log 'Having Fun yo' | |
| init = -> | |
| haveFun() | |
| publicMethods = | |
| haveFun: haveFun | |
| init: init | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment