I've tried out both examples and I like different things about each one.
To me, the routes.js file is the big key stone to these tutorials.
In the original, I like how the instances of the views are created but don't like how the require works...
define([
'jquery',
'underscore',
'backbone'
], function($, _, Backbone ){
app_router.on('route:showProjects', function(){
require(['views/projects/list'], function(ProjectListView) {
// Call render on the module we loaded in via the dependency array
// 'views/projects/list'
var projectListView = new ProjectListView();
projectListView.render();
})
});
but in the updated routes.js example -- although much less code, I don't like how the view looks like a singleton - I can't see how it's created except that I see it being passed in through the define
define([
'jquery',
'underscore',
'backbone',
'views/home/main',
'views/projects/list',
'views/users/list'
], function($, _, Backbone, mainHomeView, projectListView, userListView )
showProjects: function(){
// Call render on the module we loaded in via the dependency array
// 'views/projects/list'
projectListView.render();
},
Can you comment here on this approach vs the original where you use var projectListView = new ProjectListView();
In the updated tutorial, I see that you've created amdjs version of backbone which seems like a significant move and you've explained this in your tutorial.
backbone: 'libs/backbone/backbone-optamd3-min',
My issue is why do you have 2 tutorials? looking at Git commits - I see that they were both updated 20 days ago - with no read me files, I can't tell which one to use - I mean I imagine you believe the update tutorial is the better one... right?