lazy load EmoteMenu (#1938)
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
<!-- https://lihautan.com/notes/svelte-lazy-load/ -->
|
||||||
|
<script>
|
||||||
|
export let when = false;
|
||||||
|
export let component;
|
||||||
|
|
||||||
|
let loading;
|
||||||
|
|
||||||
|
$: if (when) {
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
function load() {
|
||||||
|
loading = component();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if when}
|
||||||
|
{#await loading then { default: Component }}
|
||||||
|
<Component />
|
||||||
|
{/await}
|
||||||
|
{/if}
|
||||||
@@ -12,7 +12,6 @@
|
|||||||
import AudioManager from "./AudioManager/AudioManager.svelte";
|
import AudioManager from "./AudioManager/AudioManager.svelte";
|
||||||
import CameraControls from "./CameraControls.svelte";
|
import CameraControls from "./CameraControls.svelte";
|
||||||
import EmbedScreensContainer from "./EmbedScreens/EmbedScreensContainer.svelte";
|
import EmbedScreensContainer from "./EmbedScreens/EmbedScreensContainer.svelte";
|
||||||
import EmoteMenu from "./EmoteMenu/EmoteMenu.svelte";
|
|
||||||
import HelpCameraSettingsPopup from "./HelpCameraSettings/HelpCameraSettingsPopup.svelte";
|
import HelpCameraSettingsPopup from "./HelpCameraSettings/HelpCameraSettingsPopup.svelte";
|
||||||
import LayoutActionManager from "./LayoutActionManager/LayoutActionManager.svelte";
|
import LayoutActionManager from "./LayoutActionManager/LayoutActionManager.svelte";
|
||||||
import Menu from "./Menu/Menu.svelte";
|
import Menu from "./Menu/Menu.svelte";
|
||||||
@@ -38,6 +37,7 @@
|
|||||||
import { LayoutMode } from "../WebRtc/LayoutManager";
|
import { LayoutMode } from "../WebRtc/LayoutManager";
|
||||||
import { actionsMenuStore } from "../Stores/ActionsMenuStore";
|
import { actionsMenuStore } from "../Stores/ActionsMenuStore";
|
||||||
import ActionsMenu from "./ActionsMenu/ActionsMenu.svelte";
|
import ActionsMenu from "./ActionsMenu/ActionsMenu.svelte";
|
||||||
|
import Lazy from "./Lazy.svelte";
|
||||||
|
|
||||||
let mainLayout: HTMLDivElement;
|
let mainLayout: HTMLDivElement;
|
||||||
|
|
||||||
@@ -116,9 +116,7 @@
|
|||||||
<VisitCard visitCardUrl={$requestVisitCardsStore} />
|
<VisitCard visitCardUrl={$requestVisitCardsStore} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if $emoteMenuStore}
|
<Lazy when={$emoteMenuStore} component={() => import("./EmoteMenu/EmoteMenu.svelte")} />
|
||||||
<EmoteMenu />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if hasEmbedScreen}
|
{#if hasEmbedScreen}
|
||||||
<EmbedScreensContainer />
|
<EmbedScreensContainer />
|
||||||
|
|||||||
Reference in New Issue
Block a user