Skip to content

Commit

Permalink
Move autoDoenload.js from public/ to src/ and update to use typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
YayunHuang committed Aug 26, 2024
1 parent c159054 commit e223530
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
12 changes: 0 additions & 12 deletions public/scripts/autoDownload.js

This file was deleted.

13 changes: 13 additions & 0 deletions src/pages/download/_autoDownload.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export function readyForAutoDownload(fn: () => void): void {
if (document.readyState != "loading") {
fn();
} else {
document.addEventListener("DOMContentLoaded", fn);
}
}

export function mainForAutoDownload(): void {
generateZIP((window as any).targetDeviceId);
}

readyForAutoDownload(mainForAutoDownload);
8 changes: 4 additions & 4 deletions src/pages/download.astro → src/pages/download/index.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
import BaseLayout from "../layouts/BaseLayout.astro";
import "/src/styles/download.css";
import ErrorPage from "../components/ErrorPage.astro";
import BaseLayout from "../../layouts/BaseLayout.astro";
import ErrorPage from "../../components/ErrorPage.astro";
import "./index.css";
---

<script>
Expand Down Expand Up @@ -43,14 +43,14 @@ import ErrorPage from "../components/ErrorPage.astro";
hideUnuseScreen();
handleDeviceIdSearchParams();
</script>
<script src="./_autoDownload.ts"></script>

<BaseLayout>
<meta
slot="meta"
name="description"
content="I've just used MockUPhone to wrap my app screenshots. It supports lots of devices including iPhone mockup, iPad mockup, Android mockup and TV mockup."
/>
<script type="text/javascript" src="/scripts/autoDownload.js"></script>
<script type="text/javascript" src="/scripts/jszip.js"></script>
<script
type="text/javascript"
Expand Down
File renamed without changes.

0 comments on commit e223530

Please sign in to comment.