Async import of brotli
This commit is contained in:
parent
0f9faa45f0
commit
ad4b21daf1
|
@ -1,6 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from 'svelte'
|
import { onMount } from 'svelte'
|
||||||
import * as brotli from '$lib/brotli'
|
|
||||||
import * as lzma from '$lib/lzma'
|
import * as lzma from '$lib/lzma'
|
||||||
import { unified } from 'unified'
|
import { unified } from 'unified'
|
||||||
import remarkParse from 'remark-parse'
|
import remarkParse from 'remark-parse'
|
||||||
|
@ -12,7 +11,7 @@
|
||||||
import 'highlight.js/styles/nord.min.css'
|
import 'highlight.js/styles/nord.min.css'
|
||||||
import TopBar from '../components/TopBar.svelte'
|
import TopBar from '../components/TopBar.svelte'
|
||||||
import Icon from '@iconify/svelte'
|
import Icon from '@iconify/svelte'
|
||||||
import { getLangFromUrl } from '$lib/utils'
|
import { getLangFromUrl } from '$lib/utils'
|
||||||
|
|
||||||
let decompressed: string
|
let decompressed: string
|
||||||
let isMarkdown = false
|
let isMarkdown = false
|
||||||
|
@ -29,7 +28,8 @@
|
||||||
if (hash.startsWith('XQAAA')) {
|
if (hash.startsWith('XQAAA')) {
|
||||||
decompressed = await lzma.decompress(hash)
|
decompressed = await lzma.decompress(hash)
|
||||||
} else {
|
} else {
|
||||||
decompressed = await brotli.decompress(hash)
|
const brotli = import('$lib/brotli')
|
||||||
|
decompressed = await (await brotli).decompress(hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Markdown
|
// Markdown
|
||||||
|
@ -65,7 +65,11 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<TopBar>
|
<TopBar>
|
||||||
<a href={'/editor' + getUrlDataPart()} class="p-1 hover:bg-gray-600/50" title="Edit a copy of this note">
|
<a
|
||||||
|
href={'/editor' + getUrlDataPart()}
|
||||||
|
class="p-1 hover:bg-gray-600/50"
|
||||||
|
title="Edit a copy of this note"
|
||||||
|
>
|
||||||
<Icon class="text-xl" icon="fluent:document-edit-16-regular" />
|
<Icon class="text-xl" icon="fluent:document-edit-16-regular" />
|
||||||
</a>
|
</a>
|
||||||
</TopBar>
|
</TopBar>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user