remove setTimeout hax in settingsv1 :squirrel:

v1.18.x
psychobunny 10 years ago
parent fdc66eb607
commit 0bc4799c3c

@ -20,7 +20,6 @@
selectMenuItem(data.url); selectMenuItem(data.url);
setupHeaderMenu(); setupHeaderMenu();
setupRestartLinks(); setupRestartLinks();
setupCheckboxes();
}); });
$(window).on('action:admin.settingsLoaded', setupCheckboxes); $(window).on('action:admin.settingsLoaded', setupCheckboxes);
@ -43,6 +42,7 @@
// move this to admin.config // move this to admin.config
app.config = config; app.config = config;
$(window).trigger('action:config.loaded');
}); });
function setupMenu() { function setupMenu() {

@ -5,18 +5,10 @@ define('admin/settings', ['uploader', 'sounds'], function(uploader, sounds) {
var Settings = {}; var Settings = {};
Settings.init = function() { Settings.init = function() {
Settings.prepare(); $(window).on('action:config.loaded', Settings.prepare);
}; };
Settings.prepare = function(callback) { Settings.prepare = function(callback) {
// Come back in 125ms if the config isn't ready yet
if (!app.config) {
setTimeout(function() {
Settings.prepare(callback);
}, 125);
return;
}
// Populate the fields on the page from the config // Populate the fields on the page from the config
var fields = $('#content [data-field]'), var fields = $('#content [data-field]'),
numFields = fields.length, numFields = fields.length,

Loading…
Cancel
Save