Over the past few years, I have been working almost exclusively on back-end tasks, and I just noticed that most JavaScript (and CoffeeScript) projects received my welcome in my absence.
I work mainly in a rail environment, and almost all of my JavaScript / jQuery is used to look like this:
$(an_element).an_event(function() { stuff_i_want_to_do; }) $(another_element).some_other_event(function() { some_other_stuff_i_want_to_do; })
Failures aside, it pretty much was.
In any case, I just looked at other people's code and noticed that in my absence many javascripters became much more beautiful. This is not complicated, but it is typical of the newer / better JavaScript approach I've seen:
jQuery -> if $('#products').length new ProductsPager() class ProductsPager constructor: (@page = 1) -> $(window).scroll(@check) check: => if @nearBottom() @page++ $(window).unbind('scroll', @check) $.getJSON($('#products').data('json-url'), page: @page, @render)
I was looking for resources for modern best practices / templates for JavaScript (and / or CoffeeScript), but I had no luck. So, in short, where should I look to be sure of success: the best javascript / coffeescript modern models and practices?
javascript jquery ruby-on-rails coffeescript
PlankTon Nov 17 '11 at 13:28 2011-11-17 13:28
source share