by nnq · 12y ago · 0 comments
`#{context}.lineTo(#{x}, #{height})`
...you're doing it wrong. Please do figure out a way to "automagically" make things work without `...` or just don't bother.`...` should be a last resort option for when you just need to do something that can't be done any other way, not something that should be peppered over the entire code.
The author used a lot of JavaScript here, likely for teaching purposes, but he could instead have used pure Ruby to interface with canvas using opal-browser. https://github.com/opal/opal-browser/blob/master/opal/browse...
The Angular interoperability is especially appealing to me. It also generates readable javascript.
On the other hand, being able to drop down to native javascript anytime you like is a huge win.
With CoffeeScript, I think I've "had" to use backticks all of about twice (I probably didn't actually have to, but it seemed easier at the time - I don't remember the exact circumstances).
Also, as others have said, the JavaScript that this outputs is a real mess (in comparison with, say, CoffeeScript).