Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Quafadas committed Mar 8, 2024
1 parent 8eb9cca commit 752c87a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions jsdocs/src/main/scala/showJsDocs.scala
Expand Up @@ -23,21 +23,19 @@ import scala.scalajs.js
import scala.scalajs.js.JSON
object showJsDocs:
def apply(path: String, node: Element, width: Int = 50) =
// val child = dom.document.getElementById(childId)
println("here!")
val child = dom.document.createElement("div")
val anId = "vega" + Random.alphanumeric.take(8).mkString("")
child.id = anId
node.appendChild(child)
child.setAttribute("style", s"width:${width}vmin;height:${width}vmin")

val opts = viz.vega.facades.EmbedOptions
val opts = viz.vega.facades.EmbedOptions()
val xhr = new XMLHttpRequest()
xhr.open("GET", s"../assets/$path.json", false)
xhr.send()
val text = xhr.responseText
val parsed = JSON.parse(text)
viz.vega.facades.embed.embed(s"#$anId", parsed, opts())
viz.vega.facades.embed.embed(s"#$anId", parsed, opts)
()
end apply
end showJsDocs

0 comments on commit 752c87a

Please sign in to comment.