2020-07-06
2764
#js libraries
Ebenezer Don
21295
Jul 6, 2020 â‹… 9 min read

Strongly typed frontend code with Scala.js

Ebenezer Don Full-stack software engineer with a passion for building meaningful products that ease the lives of users.

Recent posts:

Understanding The Latest Webkit Features In Safari 17.4

Understanding the latest Webkit features in Safari 17.4

The Safari 17.4 update brought in many modern features and bug fixes. Explore the major development-specific updates you should be aware of.

Rahul Chhodde
May 16, 2024 â‹… 10 min read
Using Webrtc To Implement Peer To Peer Video Streaming In A Node Js Project

Using WebRTC to implement P2P video streaming

Explore one of WebRTC’s major use cases in this step-by-step tutorial: live peer-to-peer audio and video streaming between systems.

Oduah Chigozie
May 16, 2024 â‹… 18 min read
Htmx Vs React

htmx vs. React: Choosing the right library for your project

Both htmx and React provide powerful tools for building web apps, but in different ways that are suited to different types of projects.

Temitope Oyedele
May 15, 2024 â‹… 9 min read
Exploring The Top Pair Programming Tools

Exploring the top 5 pair programming tools

Review the top five pair programming tools, including how to use them, their features, drawbacks, pricing models, and more.

Elijah Asaolu
May 15, 2024 â‹… 8 min read
View all posts

9 Replies to "Strongly typed frontend code with Scala.js"

  1. Im sorry, but this is awful. scala.js capabilities are no where near modern frontend frameworks such as react, vue or angular.
    If one have a large web application and would like some help with typing, would highly recommend using typescript.

    Scala is a great language, not for frontend web development. Sorry dude 🙂

  2. Great article! But I have to say, it bothers me so much watching these libraries try to turn JavaScript into something so rigid. Is it just an unwillingness to change when coming from a backend framework? Where does that leave all of the front end developers that strongly support the language as it was intended?

  3. Reply to Ryan:

    Very valid concern, Ryan. I don’t think this affects JavaScript so much or is trying to turn the language into something it’s not.

    Rather, I think it’s a good thing to give web development more options and “break-in” pathways for non-traditional front-end developers. This way, instead of trying to make JavaScript do what it was not tailored for, we can easily turn to alternatives that meet those specific needs.

  4. Respected Ebenezer sir,
    I have read your block which is really helpful for beginners like me in Scala.js. But when I run this code on my sbt , it gives me errors like
    TypeError: Cannot read property ‘appendChild’ of null
    TypeError: Cannot read property ‘appendChild’ of null
    I don’t understand where i was wrong. Please help

  5. :\pro\scala-js-timer-master>sbt
    [info] welcome to sbt 1.3.13 (Oracle Corporation Java 14.0.2)
    [info] loading settings for project scala-js-timer-master-build from metals.sbt,plugins.sbt …
    [info] loading project definition from G:\pro\scala-js-timer-master\project
    [info] loading settings for project scala-js-timer-master from build.sbt …
    [info] set current project to Scala.js test-app (in build file:/G:/pro/scala-js-timer-master/)
    [info] sbt server started at local:sbt-server-42dfb677228b318cbf0d
    sbt:Scala.js test-app> run
    [info] Compiling 3 Scala sources to G:\pro\scala-js-timer-master\target\scala-2.13\classes …
    [warn] 1 deprecation (since 2.13.3); re-run with -deprecation for details
    [warn] one warning found
    [info] Fast optimizing G:\pro\scala-js-timer-master\target\scala-2.13\scala-js-test-app-fastopt.js
    [info] Running main.Main. Hit any key to interrupt.
    TypeError: Cannot read property ‘appendChild’ of null
    TypeError: Cannot read property ‘appendChild’ of null
    at $c_Lmain_Main$.main__AT__V (file:///G:/pro/scala-js-timer-master/target/scala-2.13/scala-js-test-app-fastopt.js:1088:10)
    at $s_Lmain_Main__main__AT__V (file:///G:/pro/scala-js-timer-master/target/scala-2.13/scala-js-test-app-fastopt.js:1074:20)
    at file:///G:/pro/scala-js-timer-master/target/scala-2.13/scala-js-test-app-fastopt.js:11498:1
    at file:///G:/pro/scala-js-timer-master/target/scala-2.13/scala-js-test-app-fastopt.js:11499:4
    at Script.runInContext (vm.js:130:18)
    at Object.runInContext (vm.js:293:6)
    at processJavaScript (G:\pro\scala-js-timer-master\node_modules\jsdom\lib\jsdom\living\nodes\HTMLScriptElement-impl.js:241:10)
    at HTMLScriptElementImpl._innerEval (G:\pro\scala-js-timer-master\node_modules\jsdom\lib\jsdom\living\nodes\HTMLScriptElement-impl.js:176:5)
    at onLoadExternalScript (G:\pro\scala-js-timer-master\node_modules\jsdom\lib\jsdom\living\nodes\HTMLScriptElement-impl.js:98:12)
    at onLoadWrapped (G:\pro\scala-js-timer-master\node_modules\jsdom\lib\jsdom\browser\resources\per-document-resource-loader.js:53:33)
    [error] org.scalajs.jsenv.ExternalJSRun$NonZeroExitException: exited with code 1
    [error] at org.scalajs.jsenv.ExternalJSRun$$anon$1.run(ExternalJSRun.scala:186)
    [error] stack trace is suppressed; run last Compile / run for the full output
    [error] (Compile / run) org.scalajs.jsenv.ExternalJSRun$NonZeroExitException: exited with code 1
    [error] Total time: 13 s, completed Oct 17, 2020, 6:11:34 AM
    sbt:Scala.js test-app> fastOptJS
    [success] Total time: 0 s, completed Oct 17, 2020, 6:11:53 AM

    When index.html browse , it works as we expect. But when I run this file , it gives me error.
    Thanks for your replying Sir.

Leave a Reply