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:

Actix Web Adoption Guide: Overview, Examples, And Alternatives

Actix Web adoption guide: Overview, examples, and alternatives

Actix Web is definitely a compelling option to consider, whether you are starting a new project or considering a framework switch.

Eze Sunday
Mar 18, 2024 â‹… 8 min read
Getting Started With NativeWind: Tailwind For React Native

Getting started with NativeWind: Tailwind for React Native

Explore the integration of Tailwind CSS with React Native through NativeWind for responsive mobile design.

Chinwike Maduabuchi
Mar 15, 2024 â‹… 11 min read
Developing A Cross Platform Tv App With React Native

Developing a cross-platform TV app with React Native

The react-tv-space-navigation library offers a comprehensive solution for developing a cross-platform TV app with React Native.

Emmanuel Odioko
Mar 14, 2024 â‹… 10 min read
Essential Tools For Implementing React Panel Layouts

Essential tools for implementing React panel layouts

Explore some of the best tools in the React ecosystem for creating dynamic panel layouts, including react-resizable-layout and react-resizable-panels.

David Omotayo
Mar 13, 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