Created
May 14, 2013 22:26
-
-
Save nickrouty/5580174 to your computer and use it in GitHub Desktop.
Starting up with Marionette
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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