4 ms·
And of course, in CoffeeScript you would just use the fat arrow: somethingElse = render: => # do some rendering
by yesbabyyes 14y ago
And of course, in CoffeeScript you would just use the fat arrow:
somethingElse =
render: => # do some rendering
- Cushman 14y agoCareful, that's not the same as (->).bind(somethingElse). => binds to the current value of this at execution-- in that function, @ will compile to `var _this = this`, not `somethingElse` as we'd expect. I just tested and it looks like you can hack it by doing _this = somethingElse = render: => @renderMe # @ is somethingElse but that is definitely a bug.
- raganwald 14y agoI've written some transpilers, and I nearly always use a "magic variable" like __this_12345 just to prevent problems like--umm--this. If every single one you use has a quasi-random number or string appended, a lot of headaches melt away.