Skip to content

Commit 6e8fb89

Browse files
committed
Align to project
1 parent 42f2f05 commit 6e8fb89

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/js/index.jsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { createFileTree, createRootElement, getBrowserApi } from './lib'
55

66
import './style.css'
77

8-
const { document, MutationObserver, parseInt = Number.parseInt } = window
8+
const { document, MutationObserver, FontFace, parseInt = Number.parseInt } = window
99

1010
let observer
1111
const observe = () => {
@@ -65,20 +65,24 @@ const renderTree = () => {
6565
}
6666

6767
const loadFonts = () => {
68-
[
68+
const fonts = [
6969
{ name: 'FontAwesome', fileName: 'fontawesome.woff2' },
7070
{ name: 'Mfizz', fileName: 'mfixx.woff2' },
7171
{ name: 'Devicons', fileName: 'devopicons.woff2' },
7272
{ name: 'file-icons', fileName: 'file-icons.woff2' },
73-
{ name: 'octicons', fileName: 'octicons.woff2' },
73+
{ name: 'octicons', fileName: 'octicons.woff2' }
7474
]
75-
.map(({ name, fileName }) => new FontFace(name,
75+
76+
fonts
77+
.map(({ name, fileName }) => new FontFace(
78+
name,
7679
`url("${getBrowserApi().runtime.getURL(`fonts/${fileName}`)}") format("woff2")`,
77-
{
78-
style: 'normal',
79-
weight: 'normal'
80-
}))
81-
.forEach(async fontFace => await fontFace.load().then(loadedFont => document.fonts.add(loadedFont)))
80+
{ style: 'normal', weight: 'normal' }
81+
))
82+
.forEach(async fontFace => {
83+
const loadedFont = await fontFace.load()
84+
document.fonts.add(loadedFont)
85+
})
8286
}
8387

8488
const start = () => {

0 commit comments

Comments
 (0)