Skip to content

Instantly share code, notes, and snippets.

@shepherdwind
Forked from sankage/function.coffee
Created June 19, 2012 16:21
Show Gist options
  • Save shepherdwind/2955069 to your computer and use it in GitHub Desktop.
Save shepherdwind/2955069 to your computer and use it in GitHub Desktop.
CoffeeScript: self executing anonymous functions
# Is there a coffeescript way of doing this?
(function($, exports){
# doing random stuff here
})(jQuery, window);
# Other than this:
( ($, exports) ->
# doing random stuff here
)(jQuery, window)
# no syntactic sugar, but you can do:
do ($ = jQuery, exports = window) ->
# doing random stuff here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment