I have a following function that has to be generated from Coffeescript:
$("#user-tabs ul").idTabs({
click: function(id, all, container, settings) {
alert(id);
}
});
So, I got the following coffeescript written:
$("#user-tabs ul").idTabs ->
click: (id, all, container, settings) ->
alert(id)
return
But it doesn’t work. At the output (.js) I got following code generated:
$("#user-tabs ul").idTabs(function() {
return {
click: function(id, all, container, settings) {
alert(id);
}
};
});
So, the click function is written properly, but it is being wrapped by some “function-return” closure. How to rewrite it to reach the desired code (at the very top) ? Is it possible ?
Thanks!
Just indent the object, don’t make it a function (what
->does).See it.