Replace loadteams event with loadprefs

init:loadprefs replaces init:loadteams and now fires when
all preferences and teams are loaded.
This commit is contained in:
Guangcong Luo
2013-05-20 22:39:42 -05:00
parent 18faee531a
commit b92b7a32dd
2 changed files with 6 additions and 5 deletions

View File

@@ -9,7 +9,7 @@
// left menu
this.$el.addClass('ps-room-light').addClass('scrollable');
app.on('init:loadteams', this.update, this);
app.on('init:loadprefs', this.update, this);
this.update();
},
focus: function() {

View File

@@ -289,8 +289,9 @@
* `init:unsupported`
* triggered if the user's browser is unsupported
*
* `init:loadteams` (teams)
* triggered when loads are finished loading
* `init:loadprefs`
* triggered when preferences/teams are finished loading and are
* safe to read
*
* `init:nothirdparty`
* triggered if the user has third-party cookies disabled and
@@ -373,7 +374,7 @@
// Simple connection: no cross-domain logic needed.
Config.server = Config.server || Config.defaultserver;
this.user.loadTeams();
this.trigger('init:loadteams');
this.trigger('init:loadprefs');
return this.connect();
},
/**
@@ -440,11 +441,11 @@
TeambuilderRoom.saveTeams = function() {
postCrossDomainMessage({teams: $.toJSON(app.user.teams)});
};
self.trigger('init:loadteams');
// prefs
if (data.prefs) {
Tools.prefs.data = $.parseJSON(data.prefs);
}
self.trigger('init:loadprefs');
Tools.prefs.save = function() {
postCrossDomainMessage({prefs: $.toJSON(this.data)});
};