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
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.
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.)
I am actively building a dashboard webapp for my startup using scala.js. It is incomplete, but evolving quickly.
My initial prototype was based on angular.js, using the angulate bindings. I later replaced angular with a reactive-style mesh of scala.rx, scalatags and scalacss, which is takes advantage of the scala type system. All the logic/rendering is type safe and in one language (scala), rather than being spread across "stringly-typed" HTML, CSS and JavaScript
Although this webapp is being developed as an internal tool, it should be able to demonstrate scala.js in a real world application once it's finished.
Then
W3C uses it in banana-rf: github.com/w3c/banana-rdf
@jducoeur builds Querki : github.com/jducoeur/Querki
TypeSafe shares a very substantial template: typesafe.com/activator/template/play-scalajs-showcase
All of the above demonstrate rather advanced features & techniques.
The careful reader can learn a lot and determine for himself it ScalaJS is ready for prime time.
Lastly, this https://github.com/SemanticBeeng/play-scalajs-showcase is a derivative of the original showing how to apply event sourcing and functional domain models to move from a CRUD oriented API to a functional API. This is an experiment and work in progress.
More recently (2016), you have sri (Scala React interface).
It is a scalajs library to build truly native cross platform (mobile (ios and android) and web) applications.
It is based on reactjs and react-native.
Use this module to build browser based applications:
libraryDependencies += "com.github.chandu0101" %%% "sri-web" % "0.6.0"
The official Scala.js homepage lists projects built with Scala.js: http://www.scala-js.org/community/
ThoughtWorks's TodoMVC application with the help of Binding.scala and Scala.js:
I don't know if it is a real web project because it seems unreally concise. The DEMO contains only one source file, 147 lines of code, while the ReactJS implementation of the same TodoMVC feature took 488 lines of code.
来源:https://stackoverflow.com/questions/21831511/scala-js-for-real-web-project