Fix race conditions that could prevent applications from being loaded

This commit is contained in:
yflory
2016-10-05 11:19:18 +02:00
parent 7d5a33512a
commit 74df38f94f
2 changed files with 26 additions and 9 deletions

View File

@@ -12,9 +12,6 @@ define([
Cryptpad: Cryptpad,
};
DecorateToolbar.main($('#bottom-bar'));
Cryptpad.styleAlerts();
var padTypes = {
'/pad/': Messages.type.pad,
'/code/': Messages.type.code,
@@ -22,9 +19,9 @@ define([
'/slide/': Messages.type.slide,
};
var $table = $('table.scroll');
var $tbody = $table.find('tbody');
var $tryit = $('#tryit');
var $table;
var $tbody;
var $tryit;
var now = new Date();
var hasRecent = false;
@@ -138,11 +135,18 @@ define([
});
};
displayCreateButtons();
Cryptpad.ready(function () {
console.log("ready");
refreshTable();
$table = $('table.scroll');
$tbody = $table.find('tbody');
$tryit = $('#tryit');
DecorateToolbar.main($('#bottom-bar'));
Cryptpad.styleAlerts();
displayCreateButtons();
refreshTable();
if (Cryptpad.store && Cryptpad.store.change) {
Cryptpad.store.change(function (data) {
if (data.key === 'CryptPad_RECENTPADS') {