UNPKG

create-hydro-app

Version:

Create hydro apps with no build configuration.

43 lines (40 loc) 1.12 kB
<script type="module"> import { html, h, render, ternary, reactive, getValue, unset, } from "hydro-js"; document.head.append( <link rel="preload" href="link/" as="fetch" type="text/html" crossorigin /> ); import fetchHTML from "../@shared/fetchHTML.js"; const Link = reactive( fetchHTML({ url: "link/", errorHandler: () => unset(Link) }) ); render( <main class="m-auto center text-center"> <picture> <img class="object-contain rounded-none sm:rounded-3xl mb-6" src="@public/splash-preview.webp" data-src="@public/splash.webp" height="350" width="623" alt="" data-alt="Splash of Water" /> </picture> <h1 class="text-white">Edit app/index.html and save to reload!</h1> {ternary(Link, () => html`${getValue(Link)}`, <p>Loading ...</p>)} </main>, "main.center" ); </script> <script type="module"> import worker from "../@shared/worker.js"; worker.fib(1476).then((res) => console.log(res)); </script>