oeffisearch/client/js/app.js
2020-02-07 14:09:42 +01:00

38 lines
1 KiB
JavaScript

'use strict';
import { route, go, start } from './router.js';
import { searchView } from './searchView.js';
import { journeysView } from './journeysView.js';
import { journeyView } from './journeyView.js';
import { restoreDataStorage, ConsoleLog, loadDS100 } from './app_functions.js';
import { showDiv, hideDiv, ElementById } from './helpers.js';
export const devMode = true;
export const dataStorage = restoreDataStorage();
const main = async () => {
window.addEventListener('load', () => hideDiv('overlay'));
if (dataStorage.settings.showRIL100Names) await loadDS100();
route(/^\/$/, searchView);
route(/^\/([a-zA-Z0-9]+)$/, journeysView);
route(/^\/([a-zA-Z0-9]+)\/([-0-9]+)$/, journeyView);
if (!window.location.hash.length) go('/');
start();
}
main();
//const sw = navigator.serviceWorker;
//export let registration;
//if (sw) {
// sw.register('service-worker.js', {
// scope: './'
// }).then(function(reg) {
// ConsoleLog('Registration succeeded.');
// registration = reg;
// });
//}