News for hackers. Stuff that matters.
Re:From first principles: Why I bet on Scala.js by apo on Wednesday August 10, 2016 @03:41PM (#12264312)
Amazing work - thanks for putting it out there.

In your live coding presentation, you mentioned that the output from compiling scala to js is several files.

I'm interested in generating one file that exposed JavaScript functions that can be easily called from a js runtime.

In other words, I'd like to write a JavaScript library in Scala - not a full-blown application.

What are some good resources showing how to do this?

Re:From first principles: Why I bet on Scala.js by lihaoyi on Wednesday August 10, 2016 @03:54PM (#12264379)
The live coding presentation is two years out of date; Scala.js now compiles to a single JS blob

Everything function marked with @JSExport will be exposed to Javascript. There's no concrete difference between an application with one `@JSExport def main` method that you call to initialize it, and a library with multiple `@JSExport`ed methods. It all works the same way: the `@JSExport`ed functions are exposed, and people can call them.

This repo shows how to make a NPM library using Scala.js

- https://github.com/rockymadden/scala-node/

If you want to learn how to use `@JSExport` properly, the [core documentation](http://www.scala-js.org/tutorial/basic/) and [Hands-on Scala.js](http://www.lihaoyi.com/hands-on-scala-js/) are great.