Skip to content

Instantly share code, notes, and snippets.

@markjlorenz
Forked from sankage/function.coffee
Created August 21, 2012 01:30
Show Gist options
  • Save markjlorenz/3410381 to your computer and use it in GitHub Desktop.
Save markjlorenz/3410381 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