#js libraries
Ebenezer Don
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:

7 TUI Libraries For Creating Interactive Terminal Apps

7 TUI libraries for creating interactive terminal apps

When writing applications, a good user interface is just as important as the actual app’s functionality. A good user interface […]

Yashodhan Joshi
Jun 14, 2024 ⋅ 18 min read
Expo Router Adoption Guide Overview Examples And Alternatives

Expo Router adoption guide: Overview, examples, and alternatives

Expo Router provides an excellent file-based routing solution with crucial features such as deep linking and native support.

Marie Starck
Jun 13, 2024 ⋅ 8 min read
Superglue Vs. Hotwire For Modern Frontend Development

Superglue vs. Hotwire for modern frontend development

Explore how Superglue and Hotwire revolutionize frontend development with HTML over the wire, enhancing performance, flexibility, and ease of use.

Frank Joseph
Jun 12, 2024 ⋅ 7 min read
Using Pocketbase To Build A Full Stack Application

Using PocketBase to build a full-stack application

PocketBase is a performant Go-based tool that comes with essential features like user auth, file uploads, access control rules, and more.

Rahul Padalkar
Jun 11, 2024 ⋅ 18 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