ctucx.git: oeffisearch

[nimlang] fast and simple tripplanner

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
'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;
//	});
//}