Questions tagged [scala.js]

Scala.js is a Scala to JavaScript compiler deemed production-ready as of version 0.6.0.

Scala.js compiles Scala code to JavaScript, allowing you to write your Web application entirely in Scala!

Noteworthy features:

  • Support all of Scala, modulo a few semantic differences
  • Very good interoperability with JavaScript code. For example, use jQuery and HTML5 from your Scala.js code, either in a typed or untyped way. Or create Scala.js objects and call their methods from JavaScript.
  • Integrated with sbt (including support for dependency management and incremental compilation)
  • Can be used with your favorite IDE for Scala
  • Generates Source Maps for a smooth debugging experience (step through your Scala code from within your browser supporting source maps)
  • Integrates Google Closure Compiler for producing minimal code for production.

Find out more at scala-js.org

845 questions
0
votes
1 answer

How to test objects or other single resources / disable parallel testing with uTest

https://github.com/lihaoyi/utest As said in the documentation uTest runs tests parallel. Test cases inside one test suite can be run sequentially if used import utest.ExecutionContext.RunNow but sbt runs different test suites always parallel.…
user4955663
  • 1,039
  • 2
  • 13
  • 21
0
votes
1 answer

Scalajs: adding a border to a canvas

I've been trying to add a border to a canvas in Scalajs. I mean add a border to the Canvas itself not add a border to an object on the canvas. I am hence looking for methods on the Canvas itself not on the Graphics context from the canvas. So I have…
Rich Oliver
  • 6,001
  • 4
  • 34
  • 57
0
votes
1 answer

How to invoke 3rd party javascript from scala-js?

I need help initializing a native JS var from within a scalajs app (specifically a scalajs-react app). Fundamentally, I'm trying to use Bootstrap Responsive data-tables and I need to initialize a data table by getting the element of the data table…
bjenkins001
  • 141
  • 1
  • 9
0
votes
1 answer

How to use log4javascript with ScalaJS / PhantomJS

I try to run log4javascript with ScalaJS and PhantomJS and get an error, with Rhino it works. I took following ScalaJS example: https://github.com/scala-js/scalajs-tutorial and log4javascript I took from another ScalaJS example:…
user4955663
  • 1,039
  • 2
  • 13
  • 21
0
votes
1 answer

How to resolve log4javascript JS libraries in ScalaJS project

I have ScalaJS multi project where I try to include and use log4javascript from org.webjars. Client part of the build.sbt is here: lazy val mwlclient = (project in file("client")). settings(commonSettings: _*). settings( persistLauncher :=…
user4955663
  • 1,039
  • 2
  • 13
  • 21
0
votes
1 answer

Sbt hook for custom µtest test runner

I'm using µtest in a Scala sbt project. I want to run various test classes with a custom made test runner, which consists of code like this val results = AnotherClassWithTests.myTests.run() println(results.leaves.count(_.value.isSuccess)) I want it…
Simon Lischka
  • 155
  • 12
0
votes
1 answer

Ambiguous overloading: fix it or try something else?

Background: I'm working on using scala.js/scalatags together with scala.rx. What I'm trying to achieve is binding values from html inputs to Rx Vars, using operator style. Here's what I'm up to: implicit class BoundHtmlInput(input: Input) { def…
Haspemulator
  • 11,050
  • 9
  • 49
  • 76
0
votes
1 answer

Convert JavaScript`s Number to Scala's Double

How to convert an instance of untyped js.Dynamic, which I know is a JavaScript number, to a Scala Double type? Background: I have a js library that doesn't have a Scala.js wrapper around it (yet). It sends certain events, and I want to use those…
Haspemulator
  • 11,050
  • 9
  • 49
  • 76
0
votes
1 answer

Scala.js js.Dynamic usage leads to a recursively infinite data structure

I'm trying to use Google Visualizations from Scala.js. I generated the type definitions using TS importer and the relevant portion it generated is: @js.native trait ColumnChartOptions extends js.Object { var aggregationTarget: String = js.native …
John M
  • 1,469
  • 17
  • 41
0
votes
2 answers

export function to global scope in scalajs

Question about scalajs and javascript. How to mark a function to be purely exported to global scope? Given scala object in top level package @JSExport object Foo{ def apply(a: Int, b: Int): String = "bar"+a+b } I would like to compile this scala…
pawel.panasewicz
  • 1,831
  • 16
  • 27
0
votes
1 answer

Scalajs + Angularjs how to use external javascript plugin

I'm trying to use an external JavaScript plugin in my ScalaJs Angular directive. I don't know the best way to do that so for the moment I added this function to the window. the javascript plugin looks like this: (function(){ "use strict"; …
Loann Delgado
  • 187
  • 1
  • 9
0
votes
1 answer

Use javascript in Scala.js compiled jars

I have a Scala.js jar, foo_sjs0.6_2.11-0.1-SNAPSHOT.jar, which contains javascript for my web server, and a separated Play project for controlers/views/etc. Is there any way to compile and load .js files at runtime when I run the Play project, given…
0
votes
1 answer

error code 405 on org.scalajs.dom.ext.ajax.post

I am trying to make a post call to my (akka-http) backend from scalajs. The same call is working in postman but failing when i am actually calling from chrome - scalajs the code in scalajs ext.Ajax.post(, , headers = Map("Content-Type" ->…
Michal
  • 150
  • 3
  • 13
0
votes
1 answer

Issue using javascript library from within scala.js anonymous class

I'm trying to use this javascript library from my scala.js app (simplified runnable example). I can successfully use some parts of the api, but for other parts I'm having trouble determining the correct type signatures for my Scala facade. For…
Julian Peeters
  • 853
  • 1
  • 6
  • 19
0
votes
2 answers

Is there a standard way to convert org.scalajs.dom.raw.Promise to Future's

The raw org.scalajs.dom.raw.Promise is very close to the JS dom library. Is there a widely used library that transforms that into a scala.concurrent.Future ?
Henry Story
  • 2,116
  • 1
  • 17
  • 28