-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
57 lines (47 loc) · 1.53 KB
/
index.js
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// const app = new App(document.querySelector('#app'), {
// page: 'home',
// history: [],
// historyString: '/'
// }, (app) => {
// //Must use passed variable cause the original app variable is not defined
// app.variables.historyString = app.variables.page;
// });
// app.defineChnageWrapper('page', (prev, curr) => {
// app.variables.history.push(prev);
// });
// app.defineChnageWrapper('history', (prev, curr) => {
// app.variables.historyString = app.variables.history.reduce((acc, curr) => {
// return acc += curr + ' / ';
// }, '') + app.variables.page;
// });
// app.on('update', () => {
// });
// app.defineFunction('handleForm', (event, data) => {
// console.log(event, data);
// });
// app.defineFunction('changePage', (event, page) => {
// app.variables.page = page;
// });
// app.defineFunction('clearHistory', (event, page) => {
// app.variables.history = [];
// });
// // app.defineComponent('about', 'another.html'); //One Component from file name is setted
// app.defineComponents('another.html'); // More than one Component from file name dynamically loads
import { App } from './jwork/App.js';
import { view as profileView } from './profile.js';
import { view as errorView } from './404.js';
const app = new App(document.querySelector('#app'), [
profileView,
errorView
]);
//If no default provided the / route is default view
app.setRouter({
default: '404',
'profileView': {
route: '/',
},
'404': {
route: '/error/:code'
}
});
app.init();