mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-06 16:07:03 +03:00
Speedup boot
This commit is contained in:
parent
9158fcd0eb
commit
7cb24d4d3c
2 changed files with 8 additions and 19 deletions
18
dev/boot.js
18
dev/boot.js
|
|
@ -49,29 +49,25 @@ let RL_APP_DATA = {};
|
||||||
win.rl = {
|
win.rl = {
|
||||||
adminArea: () => admin,
|
adminArea: () => admin,
|
||||||
settings: {
|
settings: {
|
||||||
get: name => null == RL_APP_DATA[name] ? null : RL_APP_DATA[name],
|
get: name => RL_APP_DATA[name],
|
||||||
set: (name, value) => RL_APP_DATA[name] = value,
|
set: (name, value) => RL_APP_DATA[name] = value,
|
||||||
app: name => {
|
app: name => RL_APP_DATA.System[name],
|
||||||
const APP_SETTINGS = RL_APP_DATA.System || {};
|
capa: name => name && (RL_APP_DATA.Capa || []).includes(name)
|
||||||
return null == APP_SETTINGS[name] ? null : APP_SETTINGS[name];
|
|
||||||
},
|
|
||||||
capa: name => name && Array.isArray(RL_APP_DATA.Capa) && RL_APP_DATA.Capa.includes(name)
|
|
||||||
},
|
},
|
||||||
setWindowTitle: title =>
|
setWindowTitle: title =>
|
||||||
doc.title = RL_APP_DATA.Title ? (title ? title + ' - ' : '') + RL_APP_DATA.Title : (title ? '' + title : ''),
|
doc.title = RL_APP_DATA.Title ? (title ? title + ' - ' : '') + RL_APP_DATA.Title : (title ? '' + title : ''),
|
||||||
|
|
||||||
initData: appData => {
|
initData: appData => {
|
||||||
|
const cb = () => rl.app.bootstart();
|
||||||
RL_APP_DATA = appData;
|
RL_APP_DATA = appData;
|
||||||
appData
|
loadScript(appData.StaticLibJsLink)
|
||||||
? loadScript(appData.StaticLibJsLink)
|
|
||||||
.then(() => loadScript(appData.StaticAppJsLink))
|
.then(() => loadScript(appData.StaticAppJsLink))
|
||||||
.then(() => appData.PluginsLink ? loadScript(appData.PluginsLink) : Promise.resolve())
|
.then(() => appData.PluginsLink ? loadScript(appData.PluginsLink) : Promise.resolve())
|
||||||
.then(() => win.__APP_BOOT())
|
.then(() => ('loading' !== doc.readyState) ? cb() : doc.addEventListener('DOMContentLoaded', cb))
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
showError(e.message);
|
showError(e.message);
|
||||||
throw e;
|
throw e;
|
||||||
})
|
});
|
||||||
: showError();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
9
dev/bootstrap.js
vendored
9
dev/bootstrap.js
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
import { doc, dropdownVisibility, Settings } from 'Common/Globals';
|
import { dropdownVisibility, Settings } from 'Common/Globals';
|
||||||
import { i18n } from 'Common/Translator';
|
import { i18n } from 'Common/Translator';
|
||||||
|
|
||||||
import { root } from 'Common/Links';
|
import { root } from 'Common/Links';
|
||||||
|
|
@ -111,11 +111,4 @@ export default App => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
window.__APP_BOOT = () => {
|
|
||||||
const cb = () => {
|
|
||||||
window.__APP_BOOT = null;
|
|
||||||
App.bootstart();
|
|
||||||
};
|
|
||||||
('loading' !== doc.readyState) ? cb() : doc.addEventListener('DOMContentLoaded', cb);
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue