Writing a jquery plugin in coffeescript - how to get “(function($)” and “(jQuery)”?

后端 未结 8 1166
温柔的废话
温柔的废话 2020-12-13 12:55

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.exten         


        
8条回答
  •  难免孤独
    2020-12-13 13:31

    You could simply add the closure yourself and compile it with the --bare flag.

    coffee -w -c --bare jquery.plugin.coffee

    (($) ->
      # some code here
    )(jQuery)
    

提交回复
热议问题