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

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -