Skip to content

Commit 042ee50

Browse files
committed
Fix docs examples
1 parent ec4682b commit 042ee50

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

example/src/main/scala/example/Example.scala

+4-7
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,11 @@ object XMLHttpRequest{
124124
def main(pre: html.Pre) = {
125125
val xhr = new dom.XMLHttpRequest()
126126
xhr.open("GET",
127-
"http://api.openweathermap.org/" +
128-
"data/2.5/weather?q=Singapore"
127+
"https://www.boredapi.com/api/activity?type=recreational"
129128
)
130129
xhr.onload = { (e: dom.Event) =>
131130
if (xhr.status == 200) {
132-
pre.textContent =
133-
xhr.responseText
131+
pre.textContent = xhr.responseText
134132
}
135133
}
136134
xhr.send()
@@ -142,7 +140,7 @@ object Websocket {
142140
@JSExport
143141
def main(in: html.Input,
144142
pre: html.Pre) = {
145-
val echo = "ws://echo.websocket.org"
143+
val echo = "wss://echo.websocket.org"
146144
val socket = new dom.WebSocket(echo)
147145
socket.onmessage = {
148146
(e: dom.MessageEvent) =>
@@ -167,8 +165,7 @@ object AjaxExtension {
167165
.Implicits
168166
.global
169167
val url =
170-
"http://api.openweathermap.org/" +
171-
"data/2.5/weather?q=Singapore"
168+
"https://www.boredapi.com/api/activity?type=recreational"
172169
Ajax.get(url).foreach { case xhr =>
173170
pre.textContent = xhr.responseText
174171
}

readme/Index.scalatex

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
@pair("Alert", Nil)
4949

5050
@p
51-
Will cause a javascript alert box saying `HAI` to appear. Other javascript classes and objects can be similarly accessed e.g. @hl.scala{new dom.XMLHttpRequest()} to perform a new Ajax request, @hl.scala{dom.document} to access the global @hl.scala{document} object, or @hl.scala{html.Div} to to refer to the type of a @hl.scala{<div>} element.
51+
Will cause a javascript alert box saying `Hi from Scala-js-dom` to appear. Other javascript classes and objects can be similarly accessed e.g. @hl.scala{new dom.XMLHttpRequest()} to perform a new Ajax request, @hl.scala{dom.document} to access the global @hl.scala{document} object, or @hl.scala{html.Div} to to refer to the type of a @hl.scala{<div>} element.
5252

5353
@sect{Usage}
5454
@p
@@ -90,7 +90,7 @@
9090
@sect{Node.onmousemove}
9191
@pair(
9292
"EventHandler",
93-
Seq(pre("pre")),
93+
Seq(pre("Hover this box!")),
9494
autorun=true
9595
)
9696

0 commit comments

Comments
 (0)