in coffeescript, you can create a global function using
@adjustHeights = (arg1, arg2) ->
... code here
then just call this inside the js templates
Question
I find myself having a lot of code which is the same in many js responses
such as adjusting heights, and some coloration on the same class, etc.
Is there a way to put all of that duplication in a function and just call that function on each js response? If so, how?
Solution
in coffeescript, you can create a global function using
@adjustHeights = (arg1, arg2) ->
... code here
then just call this inside the js templates