Files
twtxt-lib/public/demo/loadAndParseTwtxtFile-example-source.js
2026-02-22 21:26:15 -05:00

26 lines
718 B
JavaScript

import formatSource from "./format-source.js";
formatSource(
`
\<script type="module">
import { loadAndParseTwtxtFile } from "/web/dist/twtxt-lib.js";
document
.getElementById("formLoadAndParse")
.addEventListener("submit", async (ev) => {
ev?.preventDefault();
const url =
document.getElementById("loadAndParseURL")?.value ??
"/twtxt-demos/demo-hipster-twtxt.txt";
const parsedFile = await loadAndParseTwtxtFile(url);
console.log(parsedFile);
});
<\/script>
`,
"tabLoadAndParse-panel",
);