Skip to content

Commit

Permalink
Align to project
Browse files Browse the repository at this point in the history
  • Loading branch information
berzniz committed Apr 18, 2020
1 parent 42f2f05 commit 6e8fb89
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/js/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { createFileTree, createRootElement, getBrowserApi } from './lib'

import './style.css'

const { document, MutationObserver, parseInt = Number.parseInt } = window
const { document, MutationObserver, FontFace, parseInt = Number.parseInt } = window

let observer
const observe = () => {
Expand Down Expand Up @@ -65,20 +65,24 @@ const renderTree = () => {
}

const loadFonts = () => {
[
const fonts = [
{ name: 'FontAwesome', fileName: 'fontawesome.woff2' },
{ name: 'Mfizz', fileName: 'mfixx.woff2' },
{ name: 'Devicons', fileName: 'devopicons.woff2' },
{ name: 'file-icons', fileName: 'file-icons.woff2' },
{ name: 'octicons', fileName: 'octicons.woff2' },
{ name: 'octicons', fileName: 'octicons.woff2' }
]
.map(({ name, fileName }) => new FontFace(name,

fonts
.map(({ name, fileName }) => new FontFace(
name,
`url("${getBrowserApi().runtime.getURL(`fonts/${fileName}`)}") format("woff2")`,
{
style: 'normal',
weight: 'normal'
}))
.forEach(async fontFace => await fontFace.load().then(loadedFont => document.fonts.add(loadedFont)))
{ style: 'normal', weight: 'normal' }
))
.forEach(async fontFace => {
const loadedFont = await fontFace.load()
document.fonts.add(loadedFont)
})
}

const start = () => {
Expand Down

0 comments on commit 6e8fb89

Please sign in to comment.