mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-09-30 14:52:36 -05:00
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:
@@ -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() {
|
||||
|
||||
@@ -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)});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user