3 ms·
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 J
by lihaoyi 10y ago
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/ 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/ http://www.scala-js.org/tutorial/basic/) and [Hands-on Scala.js](http://www.lihaoyi.com/hands-on-scala-js/ http://www.lihaoyi.com/hands-on-scala-js/) are great.