Scala js: getting the best of JavaScript and Scala
summary
Scala.js compiles Scala to JavaScript and is used here to build a working memory pairs game backed by the Phaser JS library. The code shows iterative facade creation with @js.native and fallbacks to js.Dynamic where typing is impractical, uses Scala collections and shuffle, models UI logic with a sealed state hierarchy and pattern matching, drives timeouts with setTimeout, and proves the workflow is practical for browser or Node targets while retaining IDE autocomplete and type safety.
AI-written summary · about
chapters (49)
- 0:00Introduction
- 0:36Scala GS
- 1:01Live coding session
- 1:39Simple memory game
- 2:30Show of hands
- 3:40Phaser
- 4:20Event Loop
- 5:00Class Declaration
- 5:38Preload Method
- 7:00Importing tools
- 8:00Translating the API
- 11:22State Manager
- 12:30Toit
- 14:20Preload
- 17:36Console
- 18:38Creating things
- 20:09Creating images
- 22:03Shuffle images
- 22:30Double loop
- 25:28Input processing
- 26:08Events
- 27:47Interact
- 28:11Game logic
- 28:46Cards
- 30:39Testing
- 31:22Declarations
- 31:40Abstract class
- 31:56Guess states
- 32:16Card class
- 33:02Abstract classes
- 33:28Interface
- 33:45Store State
- 34:06Pattern Matching
- 34:24Index
- 35:03NoGas
- 35:29One Card
- 35:49Two Cards
- 36:16Key Reuse
- 36:32Key
- 36:56Front
- 39:20Displaying score
- 41:11Untype
- 42:12Question time
- 43:25Add events
- 43:51Add index
- 44:21Check guest state
- 45:18Recompiling
- 46:01Thanks
- 46:23Source code
related talks
57mThe Magic Recipe of Scala.js: a Cross‑Platform Language
56mScala.js: Safety and Sanity in the Wild West of Web development
31mSCALAJS - WEB WITHOUT PAIN OF JAVASCRIPT
42mScala.js Semantics - and how they support performance and JavaScript interop
31mSCALA FROM B TO F - BACKEND DEVELOPER ON FRONTEND
01h 31mScala.js Workshop
54mThe Things Scala js Does to Make Your Code Fast
31mScala for Javascript Kiddies; Javascript for Scala Nerds
