javascript - How to add an argument/parameter to the safety closure in coffeescript -
javascript - How to add an argument/parameter to the safety closure in coffeescript -
coffeescript adds (function() { ... }).call(this);
compiled files. there way add together dependency, jquery example. closer this:
(function(jquery) { ... }).call(this, jquery);
you can't edit safety wrapper, , shouldn't. if want close on jquery set above, recommend doing in coffee-script, without worrying safety wrapper:
(($) -> ).call(this, jquery)
renders as:
(function(){ (function($) { }).call(this, jquery); }).call(this);
its going give same functionality.
or alternatively, utilize do
keyword:
do (jquery) ->
renders as:
(function(jquery) { })(jquery);
instant closure!
javascript coffeescript
Comments
Post a Comment