Skip to content

Commit 229db1c

Browse files
committed
Add first runnable example
1 parent 3098ca2 commit 229db1c

File tree

2 files changed

+5
-24
lines changed

2 files changed

+5
-24
lines changed

docs/readme.md

+5-23
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<<<<<<< HEAD
21
## scala-js-dom
32

43
---
@@ -45,10 +44,8 @@ You can start using the bindings using the following import:
4544
import org.scalajs.dom._
4645
```
4746

48-
4947
### Appending a child to a `Node`
5048

51-
5249
```scala mdoc:js:shared
5350
def appendElement(div: html.Div): Unit = {
5451
val child = document.createElement("div")
@@ -58,8 +55,12 @@ def appendElement(div: html.Div): Unit = {
5855
```
5956

6057
```scala mdoc:js:invisible
61-
<button class="button-run">Run</button
58+
<div id="outer-container"></div>
59+
<button id="demo1" class="button-run">Run</button>
6260
---
61+
document.getElementById("demo1").addEventListener("click", (ev: Event) => {
62+
appendElement(document.getElementById("outer-container").asInstanceOf[html.Div])
63+
})
6364
```
6465

6566
### Add an EventListener for `onmousemove`
@@ -141,11 +142,8 @@ def fetchBoredApi(element: html.Pre) = {
141142
}
142143
```
143144

144-
145-
146145
### Using Websockets
147146

148-
149147
```scala mdoc:js
150148
// TODO: currently crashes with an error
151149
// def echoWebSocket(input: html.Input, pre: html.Pre) = {
@@ -183,19 +181,3 @@ def changeColor(div: html.Div) = {
183181
The DOM API is always evolving, and `scala-js-dom` tries to provide a thin-but-idiomatic Scala interface to modern browser APIs, without breaking the spec.
184182

185183
If you see something that you think can be improved, feel free to send a pull request. See our [Contributing Guide](https://github.com/scala-js/scala-js-dom/blob/main/CONTRIBUTING.md) for a detailed overview for starting hacking on `scala-js-dom` and making a PR!
186-
=======
187-
# My Project
188-
189-
To install my project
190-
191-
```scala
192-
libraryDependencies += "com" % "lib" % "1.0.0"
193-
```
194-
195-
```scala
196-
val x = 1
197-
// x: Int = 1
198-
List(x, x)
199-
// res0: List[Int] = List(1, 1)
200-
```
201-
>>>>>>> 78916a1 (Update plugins.sbt)

project/Build.scala

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import scalatex.ScalatexReadme
2020
import sbtdynver.DynVerPlugin.autoImport.previousStableVersion
2121
import Dependencies._
2222
import Lib._
23-
import mdoc.MdocPlugin
2423

2524
object Build {
2625

0 commit comments

Comments
 (0)