summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2014-12-15 20:43:48 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2014-12-15 20:43:48 -0800
commit6e36f0e5c97951a82f943d411e35d1cb89f50fce (patch)
tree15060b8cccdd727e026ea42d114cf89c2266aa3b
parent7d14b23dbbdaf66b222839874a29fff4a34e1762 (diff)
parent6193e237ea4233d16449e1dc77bbcfb8217e97ad (diff)
downloadhands-on-scala-js-6e36f0e5c97951a82f943d411e35d1cb89f50fce.tar.gz
hands-on-scala-js-6e36f0e5c97951a82f943d411e35d1cb89f50fce.tar.bz2
hands-on-scala-js-6e36f0e5c97951a82f943d411e35d1cb89f50fce.zip
Merge pull request #15 from mrefish/edits
Hands-on Scala-js edits
-rw-r--r--book/src/main/scalatex/book/indepth/AdvancedTechniques.scalatex4
-rw-r--r--book/src/main/scalatex/book/indepth/SemanticDifferences.scalatex2
2 files changed, 3 insertions, 3 deletions
diff --git a/book/src/main/scalatex/book/indepth/AdvancedTechniques.scalatex b/book/src/main/scalatex/book/indepth/AdvancedTechniques.scalatex
index d49728f..98dccc2 100644
--- a/book/src/main/scalatex/book/indepth/AdvancedTechniques.scalatex
+++ b/book/src/main/scalatex/book/indepth/AdvancedTechniques.scalatex
@@ -76,7 +76,7 @@
Scalatags requires that anything you want to embed in a Scalatags fragment be implicitly convertible to @hl.scala{Frag}; here we are providing one for any Scala.Rx @hl.scala{Rx[T]}s, as long as the @hl.scala{T} provided is itself convertible to a @hl.scala{Frag}. We call @hl.scala{r().render} to extract the "current" value of the @hl.scala{Rx}, and then set up an @hl.scala{Obs} that watches the @hl.scala{Rx}, replacing the previous value with the current one every time its value changes.
@p
- Now that the set-up is out of the way, let's consider a simple HTML widhet that lets you enter text in a @hl.html{<textarea>}, and keeps track of the number of words, characters, and counts how long each word is.
+ Now that the set-up is out of the way, let's consider a simple HTML widget that lets you enter text in a @hl.html{<textarea>}, and keeps track of the number of words, characters, and counts how long each word is.
@split
@more
@@ -284,7 +284,7 @@
@example(canvas, "Async().main")
@p
- We have an @hl.scala{async} block, which contains a while loop. Each round around the loop, we wait for the @hl.scala{mousedown} channel to start the path, waiting for either @hl.scala{mousedown} or @hl.scala{mousedown} (which continues the path or ends it respectively), fill the shape, and then wait for another @hl.scala{mousedown} before clearing the canvas and going again.
+ We have an @hl.scala{async} block, which contains a while loop. Each round around the loop, we wait for the @hl.scala{mousedown} channel to start the path, waiting for either @hl.scala{mousemove} or @hl.scala{mouseup} (which continues the path or ends it respectively), fill the shape, and then wait for another @hl.scala{mousedown} before clearing the canvas and going again.
@p
Hopefully you'd agree that this code is much simpler to read and understand than the previous version. In particular, the control-flow of the code goes from top to bottom in a "natural" fashion, rather than jumping around ad-hoc like in the previous callback-based design.
diff --git a/book/src/main/scalatex/book/indepth/SemanticDifferences.scalatex b/book/src/main/scalatex/book/indepth/SemanticDifferences.scalatex
index ebfd1db..96f3929 100644
--- a/book/src/main/scalatex/book/indepth/SemanticDifferences.scalatex
+++ b/book/src/main/scalatex/book/indepth/SemanticDifferences.scalatex
@@ -1,6 +1,6 @@
@import BookData._
@p
- Although Scala.js tries very hard to maintain compatibility with Scala-JVM, there are some parts where the two platforms differs. This can be roughly grouped into two things: differences in the libraries available,and differences in the language itself. This chapter will cover both of these facets.
+ Although Scala.js tries very hard to maintain compatibility with Scala-JVM, there are some parts where the two platforms differs. This can be roughly grouped into two things: differences in the libraries available, and differences in the language itself. This chapter will cover both of these facets.
@sect{Language Differences}
@sect{Floats are Doubles}