blob: 33adc0aca1ddfc3301782517b5f709a18d3d0f00 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
package dotty.tools.dottydoc
package js
import scala.scalajs.js
import js.Dynamic.global
import js.JSApp
import js.annotation.{ JSExport, JSName }
import org.scalajs.dom
import model.Entities._
@JSExport object DottyDocJS {
@JSExport def main(target: dom.html.Div) = {
global.document.title = "Dotty " + ParsedIndex.currentEntity.path.mkString(".")
target.appendChild(html.Index.layout(ParsedIndex.currentEntity).render)
hljs.initHighlightingOnLoad()
}
}
object ParsedIndex {
import prickle._
import model.Entities._
val packages: Map[String, Package] = Unpickle[Map[String, Package]]
.fromString(js.JSON.stringify(Index.packages))
.toOption
.getOrElse(Map.empty)
val currentEntity: Entity = Unpickle[Entity]
.fromString(js.JSON.stringify(Index.currentEntity))
.toOption
.getOrElse(NonEntity)
}
@js.native
object Index extends js.Object {
def packages: js.Any = js.native
def currentEntity: js.Any = js.native
}
@js.native
object hljs extends js.Object {
def initHighlightingOnLoad(): js.Any = js.native
}
|