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:

Nx Adoption Guide: Overview, Examples, And Alternatives

Nx adoption guide: Overview, examples, and alternatives

Let’s explore Nx features, use cases, alternatives, and more to help you assess whether it’s the right tool for your needs.

Andrew Evans
Mar 28, 2024 â‹… 9 min read
Understanding Security In React Native Applications

Understanding security in React Native applications

Explore the various security threats facing React Native mobile applications and how to mitigate them.

Wisdom Ekpotu
Mar 27, 2024 â‹… 10 min read
Warp Adoption Guide: Overview, Examples, And Alternatives

warp adoption guide: Overview, examples, and alternatives

The warp web framework for Rust offers many enticing features. Let’s see when and why you should consider using warp in your projects.

Ukeje Goodness
Mar 26, 2024 â‹… 8 min read
Integrating Next Js And Signalr For Enhanced Real Time Web App Capabilities

Integrating Next.js and SignalR to build real-time web apps

In this tutorial, you’ll learn how to integrate Next.js and SignalR to build an enhanced real-time web application.

Clara Ekekenta
Mar 25, 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