Created
April 24, 2013 20:15
-
-
Save dealingwith/5455201 to your computer and use it in GitHub Desktop.
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
modelLoadedCount: 0, | |
incrementAndCheckModelLoadedCount: function() { | |
this.modelLoadedCount++; | |
// do this better than hardcoding the count. | |
// maybe store models in an object or array and do a count? | |
// i don't like that idea any better than this at the moment | |
if (this.modelLoadedCount === 2) { | |
this.allModelsLoaded(); | |
} | |
}, | |
initialize: function() { | |
Game.player = new Game.Player; | |
Game.property = new Game.Property; | |
Game.player.on('loaded', _.bind(this.playerModelLoaded, this)); | |
Game.property.on('loaded', _.bind(this.propertyModelLoaded, this)); | |
}, | |
render: function() { | |
FB.getLoginStatus(_.bind(this.loginCallback, this)); | |
return this; | |
}, | |
playerModelLoaded: function() { | |
this.incrementAndCheckModelLoadedCount(); | |
// Set up subviews, get data | |
this.subViews.profileView = new Profile.View; | |
this.subViews.leaderboardView = new Leaderboard.View; | |
this.subViews.rateView = new Rate.View; | |
this.subViews.reviewView = new Review.View; | |
this.subViews.followView = new Follow.View; | |
Game.property.getPropertyDetails(); | |
}, | |
propertyModelLoaded: function() { | |
this.incrementAndCheckModelLoadedCount(); | |
this.subViews.prizesView = new Prizes.View; | |
}, | |
allModelsLoaded: function() { | |
this.subViews.shareView = new Share.View; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment