Skip to content

Instantly share code, notes, and snippets.

@nickrouty
Created May 14, 2013 22:26
Show Gist options
  • Save nickrouty/5580174 to your computer and use it in GitHub Desktop.
Save nickrouty/5580174 to your computer and use it in GitHub Desktop.
Starting up with Marionette
$(function(){
window.AFA = {};
AFA.Models = {};
AFA.Collections = {};
AFA.Views = {};
AFA.Models.User = Backbone.Model.extend({
initialize: function(){
var devices = new AFA.Collections.Devices(this.get('devices'));
this.set('devices', devices);
}
});
AFA.Models.Device = Backbone.Model.extend({
initialize: function(){
var apps = new AFA.Collections.Apps(this.get('apps'));
this.set('apps', apps);
}
});
/*
* Some more model definitions here
*/
/*
* Initialize Application
*
*/
AFA.App = Backbone.Marionette.Application();
AFA.App.addRegions({
'navigation': '#app-navigation',
'menu': '#app-menu',
'content': '#app-content'
});
AFA.App.on('initialize:after', function(){
Backbone.history && Backbone.history.start() || console.error('No "Backbone.history" to .start()');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment