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
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.