From 178d3474b886b8e5e2aaf65f02787cddaf9e57aa Mon Sep 17 00:00:00 2001 From: Nulo Date: Tue, 12 Oct 2021 19:38:51 -0300 Subject: [PATCH] Demo: poner JSON en
--- demo/demo.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) {