Skip to content

Instantly share code, notes, and snippets.

@simon-lang
Created August 7, 2012 06:43
Show Gist options
  • Select an option

  • Save simon-lang/3282432 to your computer and use it in GitHub Desktop.

Select an option

Save simon-lang/3282432 to your computer and use it in GitHub Desktop.
Revealing Module Pattern in CoffeeScript
# 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