Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala-JS for real web project [closed]

Tags:

Has someone used Scala-JS in real web project but not only for plain JavaScript replacement in isolated env ?

I would like to use Scala as much as possible (I wish I could). And seems Scala-JS claims to be that lib I could use (now) or in the future.

That's why I'm interested in small working solution to look at, to bootstrap (like PlayFramework app where Scala-JS).

The solution/example that could demonstrate that Scala-JS can be used in real web-development work.

I'm asking because what I found about Scala-JS so far is hardly real usage of it.

Q: some examples / proves that It is ready to use in real project?

UPDATE (after 1 year):

There are tons of examples for TypeScript for example.. That what I mean when I said "examples" and "real web projects". And there many online trainings. And if I query in Google: "typescript github angular", it returns 172 000 pages. ScalaJS has lack of all it definitely and unfortunately.

But it has some: ' "scala-js" github angular ' - 4 980 matches. But so far most of it is "early stage of development" with "no commercial support"

That one seems promising: https://github.com/greencatsoft/scalajs-angular

like image 375
ses Avatar asked Feb 17 '14 14:02

ses


2 Answers

I haven't seen client-side form validation specifically, yet. However, there are several projects that use Scala.js effectively, among which:

  • A basic setup with PlayFramework, where client-side JS is written in Scala.js
  • A more significant example with PlayFramework essentially demonstrating the Scala.js actors proof-of-concept
  • Other projects written in Scala.js but with nothing to do with Play, but that demonstrate Scala.js' power to varying degrees.
  • Roll, probably the most significant Scala.js project so far.
like image 183
sjrd Avatar answered Sep 21 '22 14:09

sjrd


I just noticed this question, and should probably chime in -- as mentioned above, my company's product, Querki, has its UI now built entirely in Scala.js. That's about 8k SLOC of Scala, last I checked: not the biggest program in the world, but a lot more complex than most sites. I would guess that it's replacing what would have been 20-30k SLOC of JavaScript, and is really the only way the company is plausible at all.

That's beta for a small company, but very much in production, and it's been a godsend: the SJS code is vastly easier to write and maintain than the JavaScript it replaced, and much more stable in practice. Also, hooking the SJS front end up to my Akka/Play back end speeds up development enormously, and reduces bugs, since the API is strongly-typed and boilerplate-free, in end-to-end Scala.

Since folks have asked: the optimized JS code is currently about 1 Meg, and growing quite slowly now that all my infrastructure is written. (Plus about as much again for the JS libraries I use.) That's not trivial, but it's a one-time load per release; once it's cached in the browser, the UI is extremely fast, much quicker than the dynamic pages that had been there.

Oh, and since you're looking for a fully-worked example: the source code can be found on GitHub. That's open-but-restricted, since it's a commercial product, but feel free to dig around and use it for inspiration. (And feel free to request useful bits out of it: I'm gradually lifting broadly-useful bits and pieces into MIT-licensed libraries.)

like image 45
Justin du Coeur Avatar answered Sep 18 '22 14:09

Justin du Coeur