How to pass two anonymous functions as arguments in CoffeScript?

后端 未结 4 889
误落风尘
误落风尘 2020-11-29 04:06

I want to pass two anonymous functions as arguments for jQuery\'s hover, like so:

$(\'element\').hover(
  function() {
    // do stuff on mouseover
  },
  fu         


        
4条回答
  •  悲&欢浪女
    2020-11-29 04:21

    Another way is to use backslash after the caller function, the comma should be indented correctly.

    $('element').hover \
      -> # do stuff on mouseover
      ,
      -> # do stuff on mouseout
    

提交回复
热议问题