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:

Comparing Mutative Vs Immer Vs Reducers For Data Handling In React

Comparing React state tools: Mutative vs. Immer vs. reducers

Mutative processes data with better performance than both Immer and native reducers. Let’s compare these data handling options in React.

Rashedul Alam
Apr 26, 2024 â‹… 7 min read
Radix Ui Adoption Guide Overview Examples And Alternatives

Radix UI adoption guide: Overview, examples, and alternatives

Radix UI is quickly rising in popularity and has become an excellent go-to solution for building modern design systems and websites.

Nefe Emadamerho-Atori
Apr 25, 2024 â‹… 11 min read
Understanding The Css Revert Layer Keyword, Part Of Css Cascade Layers

Understanding the CSS revert-layer keyword

In this article, we’ll explore CSS cascade layers — and, specifically, the revert-layer keyword — to help you refine your styling strategy.

Chimezie Innocent
Apr 24, 2024 â‹… 6 min read
Exploring Nushell, A Rust Powered, Cross Platform Shell

Exploring Nushell, a Rust-powered, cross-platform shell

Nushell is a modern, performant, extensible shell built with Rust. Explore its pros, cons, and how to install and get started with it.

Oduah Chigozie
Apr 23, 2024 â‹… 6 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