Skip to content

Commit 7b1c290

Browse files
committed
Update readme.md with a few more words
1 parent 8d53756 commit 7b1c290

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
scala-js-dom
22
============
33

4-
Provides a nice statically typed interface to the DOM such that it can be called from Scala code without resorting to `js.Dynamic`.
4+
Scala-js-dom provides a nice statically typed interface to the DOM such that it can be called from Scala code without resorting to `js.Dynamic`. All javascript globals functions, singletons and classes are members of the `org.scalajs.dom`, e.g.
55

6-
Also contains useful extension methods in `org.scalajs.dom.extensions`, which allow the DOM api to be used in a more idiomatic and fluent way. The goal of this project is to provide a thin-but-idiomatic-scala interface to modern browser APIs. In particular:
6+
```scala
7+
import org.scalajs.dom
8+
dom.alert("HAI")
9+
```
10+
11+
Will cause a javascript alert box saying `HAI` to appear. Other javascript classes and objects can be similarly accessed e.g. `new dom.XMLHttpRequest()` to perform a new Ajax request, `dom.document` to access the global `document` object, or `dom.setInterval(() => ???, 1000)` to schedule a recurring task every second. The names of these functions/singletons/classes match their Javascript equivalents exactly, so if you want to know how to do something (e.g. "how do I open a websocket connection") the syntax is the same as if you were using raw Javascript.
12+
13+
Scala-js-dom also contains useful extension methods in `org.scalajs.dom.extensions`, which allow the DOM api to be used in a more idiomatic and fluent way. The goal of this project is to provide a thin-but-idiomatic-scala interface to modern browser APIs. In particular:
714

815
- Deprecated properties/methods/types will not be present.
916
- IE-only, Chrome-only, FF-only, and in general browser-specific attributes will not be present.
@@ -12,6 +19,8 @@ Also contains useful extension methods in `org.scalajs.dom.extensions`, which al
1219
- Read-only members should be `def`, and not-directly-instantiable classes should have `private` constructors.
1320
- `org.scalajs.dom` contains DOM class/member stubs, while `org.scalajs.dom.extensions` contains implicit conversions and useful Scala types (e.g. `Color`) to make usage of the DOM more idiomatic Scala.
1421

22+
Apart from `Color`, Scala-js-dom contains some useful helpers in `org.scalajs.dom.extensions` that serve no purpose other than to make your use of the DOM more pleasant. Examples include the `Ajax.get` and `Ajax.post` methods which let you avoid messing with `dom.XMLHttpRequest` directly, or `KeyCodes` which provides a nice list of the keycodes that result from pressing various keys on the keyboard.
23+
1524
Usage
1625
-----
1726

@@ -21,7 +30,7 @@ Add the following to your sbt build definition:
2130

2231
then enjoy the types available in `org.scalajs.dom`.
2332

24-
See also [roll](https://github.com/lihaoyi/roll) ([live demo](http://lihaoyi.github.io/roll/)) and [scala-js-games](https://github.com/lihaoyi/scala-js-games) for an example of its use. There remain lots more cleanup to do, but this should be a reasonable place to start from. Pull requests/forks are welcome!
33+
See also [roll](https://github.com/lihaoyi/roll) ([live demo](http://lihaoyi.github.io/roll/)) and [scala-js-games](https://github.com/lihaoyi/scala-js-games) for an example of its use. [Scala-js-fiddle](http://www.scala-js-fiddle.com/) also contains a pile of [fun examples](http://www.scala-js-fiddle.com/gist/9405209/Oscilloscope.scala) that demonstate its usage. Pull requests/forks are welcome!
2534

2635
Contributing
2736
------------

0 commit comments

Comments
 (0)