Keep trying until the first tab is loaded

This commit is contained in:
yflory 2018-10-02 18:14:06 +02:00
parent c59d744d78
commit 5d3d591228

View File

@ -1661,20 +1661,17 @@ define([
*/ */
var initialized = false; var initialized = false;
var whenReady = function (cb, i) { var whenReady = function (cb) {
if (store.returned) { return void cb(); } if (store.returned) { return void cb(); }
if (i === 600) { return void cb(true); }
i = i || 0;
setTimeout(function() { setTimeout(function() {
whenReady(cb, ++i); whenReady(cb);
}, 100); }, 100);
}; };
Store.init = function (clientId, data, _callback) { Store.init = function (clientId, data, _callback) {
var callback = Util.once(_callback); var callback = Util.once(_callback);
if (initialized) { if (initialized) {
return void whenReady(function (isTo) { return void whenReady(function () {
if (isTo) { return void callback({error: 'TIMEOUT'}); }
callback({ callback({
state: 'ALREADY_INIT', state: 'ALREADY_INIT',
returned: store.returned returned: store.returned