Async import of brotli

This commit is contained in:
Simon Cambier 2023-11-24 19:00:49 +01:00
parent 0f9faa45f0
commit ad4b21daf1

View File

@ -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'
@ -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>