Scala-JS for real web project [closed]

走远了吗. 提交于 2019-12-02 17:10:37

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

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

  1. W3C uses it in banana-rf: github.com/w3c/banana-rdf

  2. @jducoeur builds Querki : github.com/jducoeur/Querki

  3. 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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!