Show HN: I rewrote the Backbone.js Todo example
ahamlett.com
ahamlett.com
https://github.com/dart-lang/web-ui/tree/master/example/todo...
define(function(require){ var whatever = require('dependency'); });
instead of
define([ 'dependency', ], function(whatever) { });
We do this because it's way more readable for files with numerous dependencies.
Also, we make Backbone, $ and _ globals so we don't have to inject them in every single module.
We don't; we explicitly define every dependency, always, so that it does not make any assumptions about the environment it runs in (a webpage with jquery / underscore included via script tags, for example). Second, our end-product is a single .js with Backbone and some other dependencies all combined into it. (we're not allowed to use a CDN)
We did it when we realized 100% of our modules had those three dependencies. Haven't found a drawback yet.
What do you think?
Probably should be named TodoCollection.js either way.
As someone looking at this for the first time, even after breezing over the code that was my immediate question: wait, where was the collection again?
For fuck's sake, people - it's 2013. Get with the CoffeeScript program already.
(That being said, I love LESS and can't imagine writing pure CSS, so I do understand how you feel.)
I'm curious why you did not use CoffeeScript when you updated this example?