Coder Social home page Coder Social logo

Comments (3)

davesmith00000 avatar davesmith00000 commented on June 18, 2024

I wrote this issue up rather quickly yesterday, and today I'm feeling paranoid that it reads as rather blunt/abrupt, or that I'm expecting you to do something. I'm not expecting anything, just trying to be helpful - apologies if the original description doesn't come across that way. :-)

from scalajs-benchmark.

japgolly avatar japgolly commented on June 18, 2024

Hi! Firstly thank you for the clarification message. I've no problem with your original but I really appreciate the kindness and know exactly what you mean in feeling how you felt. Text always seems to be a bit more ambiguous without a tone of voice bundled with it.

Unfortunately I don't have the time to spend making a nice getting started guide (at least for a while). I was kind of hoping that having the real working demo project and the examples in the readme would be enough, but I can see how that actually relies on quite a bit of implicit knowledge.

Which is a perfect segue to the issue you're seeing and the questions you're asking about. The implicit knowledge required there is pure Scala.js knowledge, and not scalajs-benchmark specific. I think you'd have the same problems with any other lilbrary... which I'm sure provides exactly zero comfort to you now haha. Let me do my best:

How to run it - I went for fastOptJS and a local http server but is that right?

There's no One Way for running Scala.js stuff. For short and sweet projects like this demo (and the scalajs-react ghpages site for another example), I just have a few static html files, and a little python server to serve both those files and the Scala.js-generated JS files. For larger projects I use something like http4s, or even a servlet + Jetty. There are some sbt plugins to make it nice and pleasant, (sbt-revolver is simple and awesome, for example).

It doesn't mention @JSExportTopLevel("main") - I should have known about that one but I still tripped over it.

Yeah you've got to expose some kind of function, which you then call from a little inline <script> tag in your html. Scala.js used to have the ability to add a little code to your generated JS, so that it calls your function as well; I just can't remember if that's still present or it's been removed. Either way, I personally don't use it but it's probably an option!

Should I be exporting modules? The HTML file examples suggest not?

Nah no need to export a module. You're gonna laugh when I tell you this but I think the problem you're having is that your def main is asking for a Array[String], where as when you call it from your html, you're calling main(), which is like calling main(undefined) 😅. Try using def main(): Unit instead and I think you'll be in business.

Now all of that aside, not to be rude or anything but I've got tons on so I can be a bit infrequent in checking in on OSS issues. If you don't mind a delay then np, but you'd be able to get immediate feedback if you check out the Scala.js gitter. From what I've seen they're pretty nice and friendly, and pretty quick to respond too.

I hope that helps!

from scalajs-benchmark.

davesmith00000 avatar davesmith00000 commented on June 18, 2024

Hi,

There were two problems:

  1. As you said, calling main() with the wrong args.
  2. Requires the inclusion of the charts lib.

I've submitted a PR for your consideration that may help the next person: #229

Thanks again,

Dave

from scalajs-benchmark.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.