diff --git a/demo/demo.ts b/demo/demo.ts index 02de6a3..729b712 100644 --- a/demo/demo.ts +++ b/demo/demo.ts @@ -23,6 +23,11 @@ function clear(el: Node) { } function objectToDom(object: any) { + const detailsEl = document.createElement("details"); + const summaryEl = document.createElement("summary"); + summaryEl.append("JSON"); + detailsEl.open = true; + detailsEl.append(summaryEl); const preEl = document.createElement("pre"); const codeEl = document.createElement("code"); if (typeof object === "string") { @@ -33,7 +38,8 @@ function objectToDom(object: any) { codeEl.append(object); } preEl.append(codeEl); - return preEl; + detailsEl.append(preEl); + return detailsEl; } async function showResponse(statusEl: Element | null, promise: Promise) {