Skip to content

Fix docs examples #426

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions example/src/main/scala/example/Example.scala
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,8 @@ object XMLHttpRequest{
@JSExport
def main(pre: html.Pre) = {
val xhr = new dom.XMLHttpRequest()
xhr.open("GET",
"http://api.openweathermap.org/" +
"data/2.5/weather?q=Singapore"
xhr.open("GET",
"https://www.boredapi.com/api/activity"
)
xhr.onload = { (e: dom.Event) =>
if (xhr.status == 200) {
Expand All @@ -142,7 +141,7 @@ object Websocket {
@JSExport
def main(in: html.Input,
pre: html.Pre) = {
val echo = "ws://echo.websocket.org"
val echo = "wss://echo.websocket.org"
val socket = new dom.WebSocket(echo)
socket.onmessage = {
(e: dom.MessageEvent) =>
Expand All @@ -167,8 +166,7 @@ object AjaxExtension {
.Implicits
.global
val url =
"http://api.openweathermap.org/" +
"data/2.5/weather?q=Singapore"
"https://www.boredapi.com/api/activity"
Ajax.get(url).foreach { case xhr =>
pre.textContent = xhr.responseText
}
Expand Down
4 changes: 2 additions & 2 deletions readme/Index.scalatex
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
@pair("Alert", Nil)

@p
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.
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.

@sect{Usage}
@p
Expand Down Expand Up @@ -90,7 +90,7 @@
@sect{Node.onmousemove}
@pair(
"EventHandler",
Seq(pre("pre")),
Seq(pre("Hover this box!")),
autorun=true
)

Expand Down