I am writing a jquery plugin in coffeescript but am not sure how to get the function wrapper part right.
My coffeescript starts with this:
$.fn.extend({
myplugin: ->
@each ->
Which creates the javascript with a function wrapper:
(function() {
$.fn.extend({
myplugin: function() {
return this.each(function() {
but I want a '$' passed in like this:
(function($) {
$.fn.extend({
Similar for the ending I have... nothing in particular in coffeescript.
I get this in javascript:
})();
But would like this:
})(jQuery);
Does anyone know how to achieve this with the coffeescript compiler?
Or what is the best way to get this done within coffeescript?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…