summaryrefslogtreecommitdiff
path: root/book/src/main/scalatex/book/Index.scalatex
blob: 7a7e2b8290f2a9a6488c8e61c64d68c49d60a3c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
@import BookData._

@val firstHalfDescription = """
is a set of tutorials that walks you through getting started with Scala.js. You'll build a range of small projects, from Making a Canvas App to Interactive Web Pages to Integrating Client-Server, and in the process will get a good overview of both Scala.js's use cases as well as the development experience
"""
@val secondHalfDescription = """
is a set of detailed expositions on various parts of the Scala.js platform. Nothing in here is necessary for you to make your first demos, but as you dig deeper into the platform, you will likely need or want to care about these things so you can properly understand what's going on "under the hood"
"""
@sect("Hands-on Scala.js", "Writing client-side web applications in Scala")
  @split
    @more
      @hl.ref("examples/demos/src/main/scala/Splash.scala", "var x")

    @less
      @BookData.example(canvas, "Splash().main")

  @p
    @lnk("Scala.js", "http://www.scala-js.org/") is a compiler that compiles Scala source code to equivalent Javascript code. That lets you write Scala code that you can run in a web browser, or other environments (Chrome plugins, Node.js, etc.) where Javascript is supported. This book is an introduction to Scala.js, which aims to get you from knowing-nothing about it to being relatively proficient.

  @p
    This book contains something for all levels of experience with Scala.js: absolute beginners can get started with the @sect.ref{Intro to Scala.js} and @sect.ref{Hands On} tutorial, people who have used it before can skip ahead to the later parts of the tutorial: @sect.ref{Making a Canvas App} or @sect.ref{Interactive Web Pages}. Intermediate users will find interest in the chapters on @sect.ref{Cross Publishing Libraries} with Scala.js or @sect.ref{Integrating Client-Server}, and even experienced users will find the @sect.ref{In Depth} documention useful. Feel free to explore the navigation bar on the left to find chapters of interest.

  @p
    Even if we do not require any familiarity of Scala.js, this book nonetheless assumes a good amount of background knowledge: of Scala, of Javascript, and of web development as a whole. In general, you will not need deep knowledge of any of these subjects, though if you are coming in entirely without knowledge of any one of them, you'll have to be willing to spend time Google-ing things and picking things up as we go along. Someone who comes in without previous web-dev experience may miss or not-notice many of the nice touches and benefits that Scala.js brings to the table, having never done web-dev any other way,

  @p
    Many of the code samples are taken from examples available on the book's @lnk("Github Page", "https://github.com/lihaoyi/scala-js-book"); for those code samples (e.g. the animation above), there is a @i(cls:="fa fa-link ") link in the bottom-right corner of the snippet that you can click on to go to the original code. These come in handy if you find you need additional context around the snippet, e.g. what imports you need for the code to work, or what the complete executable example looks like.

  @p
    This book is roughly divided into two sections:

  @ul
    @li
      @sect.ref{Hands On} @firstHalfDescription
    @li
      @sect.ref{In Depth} @secondHalfDescription

  @p
    Feel free to jump ahead to either of them if you have some prior exposure to Scala.js. If not, it is best to start with the introduction...

@sect{Intro to Scala.js}
  @Intro()

@sect("Hands On", "Writing your first Scala.js programs")
  @p
    This half of the book @firstHalfDescription

  @sect{Getting Started}
    @handson.GettingStarted()

  @sect{Making a Canvas App}
    @handson.CanvasApp()

  @sect{Interactive Web Pages}
    @handson.WebPage()

  @sect{The Command Line}
    @handson.CommandLine()

  @sect{Cross Publishing Libraries}
    @handson.PublishingModules()

  @sect{Integrating Client-Server}
    @handson.ClientServer()

@sect("In Depth", "Exploring Scala.js")
  @p
    This half of the book @secondHalfDescription

  @sect{Advanced Techniques}
    @indepth.AdvancedTechniques()

  @sect{Deviations from Scala-JVM}
    @indepth.SemanticDifferences()

  @sect{The Compilation Pipeline}
    @indepth.CompilationPipeline()

  @sect{Scala.js' Design Space}
    @indepth.DesignSpace()

  @sect{Java APIs}
    @indepth.JavaAPIs()