Lexiconga/src/index.js

30 lines
816 B
JavaScript
Raw Normal View History

2019-05-02 23:45:10 +02:00
import setupListeners from './js/setupListeners';
import { renderAll } from './js/render';
import { hasToken, addMessage } from './js/utilities';
import { loadDictionary } from './js/dictionaryManagement';
import { loadSettings } from './js/settings';
import { setupAds } from './js/ads';
2019-05-02 23:45:10 +02:00
2019-05-02 18:57:56 +02:00
function initialize() {
if (window.isOffline) {
addMessage('<strong>You are using the Offline version of Lexiconga.</strong><br>Refresh the page while connected to the internet to enable using accounts.', 0);
}
loadSettings();
loadDictionary();
setupListeners();
if (hasToken()) {
import('./js/account/index.js').then(account => {
account.loginWithToken();
});
}
setupAds();
renderAll();
2019-05-02 18:57:56 +02:00
}
window.onload = (function (oldLoad) {
oldLoad && oldLoad();
initialize();
2019-05-02 18:57:56 +02:00
})(window.onload);