2. Who am I?
● Scala Programmer at BizReach, Inc
● 4+ years Scala experience
● GitBucket developer / Scalatra committer
3. Scala Warrior
● A game written in Scala for learning Scala
● Inspired by Ruby Warrior
● Based on Scala.js, ScalaTags and ScalaCSS
https://github.com/scalawarrior/scalawarrior
4. Server
(Play2)
Architecture of Scala Warrior
Web Browser
Scala
JavaScript
2. Compile Scala code to
JavaScript by Scala.js compiler
1. Send Scala code edited by user
3. Evaluate responded JavaScript code
9. Scala.js is universal!
Play project (server-side)
Scala.js project (client-side)
Cross-build project (common)
10. Interoperability
● Need type mapping like .d.ts
○ scala-js-ts-importer can convert from .d.ts
○ You can find a lot of .d.ts at DefinitelyTyped
○ But can't convert perfectly...
● js.Dynamic (not type-safe)
import scala.scalajs.js.Dynamic._
val editor: Dynamic = global.ace.edit("editor")
20. There is a big wall
● Generated JavaScript file size
● Cost for creating type mappings
● Existing front-end eco-system
21. There is a big wall
● Generated JavaScript file size
● Cost for creating type mappings
● Existing front-end eco-system
● Should front-end engineer write Scala?
22. The Approach
Scala.js: Beyond the Coast-to-Coast Approach by Katrin Shechtman
https://www.youtube.com/watch?v=aqtoe0xDayM
26. Why Scala in frontend?
● Scala.js is not ALL or NOTHING!
○ Scala programmers can provide libraries for
frontend using Scala.js
○ JavaScript programmer can use existing frontend
tools and frameworks