-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.ts
More file actions
30 lines (24 loc) · 756 Bytes
/
app.ts
File metadata and controls
30 lines (24 loc) · 756 Bytes
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
import Router from './core/router';
import { NewsFeedView, NewsDetailView } from './page';
import { Store } from './store';
// import { Store } from './types';
// const store: Store = {
// currentPage: 1,
// feeds: []
// };
// // 타입스크립트에서 브라우저 전역 객체에 할당하는 방법 [[
// declare global {
// interface Window {
// store: Store;
// }
// }
// window.store = store;
// // ]] 전역
const store = new Store();
const router: Router = new Router();
const newsFeedView = new NewsFeedView('root', store);
const newsDetailView = new NewsDetailView('root', store);
router.setDefaultPage(newsFeedView);
router.addRoutePath('/page/', newsFeedView);
router.addRoutePath('/show/', newsDetailView);
router.route();