-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathnewtab.ts
25 lines (20 loc) · 982 Bytes
/
newtab.ts
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
// Theme loader code must run first
import './theme';
import { append, fragment } from 'stage1';
import { BookmarkBar } from './components/BookmarkBar';
import { Menu } from './components/Menu';
import { Search } from './components/Search';
import { handleClick, storage } from './utils';
performance.mark('Initialise Components');
const container = fragment();
// Create Search component first because it has asynchronous calls that can
// execute while the remaining components are constructed
append(Search(), container);
// Create BookmarkBar component near last because, after an async call, it needs
// to synchronously and sequentially calculate DOM layout multiple times and
// could cause reflow in extreme situations, so paint the rest of the app first
if (!storage.b) append(BookmarkBar(), container);
append(Menu(), container);
append(container, document.body);
performance.measure('Initialise Components', 'Initialise Components');
document.onclick = handleClick;