cleanup boot.js

This commit is contained in:
djmaze 2020-09-22 09:50:52 +02:00
parent 31d9ea53b9
commit 07b002a66a

View file

@ -11,9 +11,9 @@ const
Storage = type => { Storage = type => {
let name = type+'Storage'; let name = type+'Storage';
try { try {
win[name].setItem('storage', ''); win[name].setItem(name, '');
win[name].getItem('storage'); win[name].getItem(name);
win[name].removeItem('storage'); win[name].removeItem(name);
} catch (e) { } catch (e) {
console.error(e); console.error(e);
const cookieName = encodeURIComponent(name+('session' === type ? win.name || (win.name = Date.now()) : '')); const cookieName = encodeURIComponent(name+('session' === type ? win.name || (win.name = Date.now()) : ''));
@ -47,14 +47,6 @@ const
p.end(); p.end();
}, },
runMainBoot = withError => {
if (win.__APP_BOOT && !withError) {
win.__APP_BOOT(() => showError());
} else {
showError();
}
},
writeCSS = css => { writeCSS = css => {
const style = doc.createElement('style'); const style = doc.createElement('style');
style.type = 'text/css'; style.type = 'text/css';
@ -190,11 +182,15 @@ win.__initAppData = appData => {
return appData.PluginsLink ? loadScript(appData.PluginsLink) : Promise.resolve(); return appData.PluginsLink ? loadScript(appData.PluginsLink) : Promise.resolve();
}) })
.then(() => { .then(() => {
p.set(70); if (win.__APP_BOOT) {
runMainBoot(false); p.set(70);
win.__APP_BOOT(() => showError());
} else {
showError();
}
}) })
.catch((e) => { .catch((e) => {
runMainBoot(true); showError();
throw e; throw e;
}) })
.then(() => { .then(() => {
@ -206,7 +202,7 @@ win.__initAppData = appData => {
} }
}); });
} else { } else {
runMainBoot(true); showError();
} }
}; };