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

type String is not a member of package scala.scalajs.js

I just upgraded from version 0.5.6 to 0.6.3 of the Scala js and now some of my code no longer compiles. I have defined the following object: trait Call extends js.Object { val name: js.String = ??? val params: js.Dictionary[String] = ???…
user79074
  • 4,937
  • 5
  • 29
  • 57
0
votes
1 answer

Cannot call require('fs') with PhantomJS runner

I've been trying to use the FS API in PhantomJS, but I get an error I'm not able to understand when I run the following code private[scalajssupport] object PhantomFile { val fs: PhantomFS =…
ssidorenko
  • 140
  • 5
0
votes
1 answer

JQuery Mobile and Scala.js: How to call functions like "navbar()" or "toolbar()"?

In JQuery mobile, to make persistent headers, footers and nabbers work as expected, you have to do something like this: $(function() { $( "[data-role='navbar']" ).navbar(); $( "[data-role='header'], [data-role='footer']"…
rabejens
  • 7,594
  • 11
  • 56
  • 104
0
votes
1 answer

Access the JS this from scala.js

I need to implement a call from scala.js a method like: sigma.classes.graph.addMethod('getNodesCount', function() { return this.nodesArray.length; }); that is the way that bring the library in JS to access the internal array nodesArray of the…
gilcu2
  • 343
  • 3
  • 13
0
votes
1 answer

How ensure that scala.js method parameter is a literal

how can I ensure that a method receive a javascript literal (js.dynamic.literal). It is not a type but it is js.Dynamic so it can be anything. Thanks
gilcu2
  • 343
  • 3
  • 13
0
votes
2 answers

facade for a method that returns Promise in ScalaJS

I am writing facade for PouchDB Put Method here is my facde @JSName("PouchDB") class PouchDB extends js.Object { type CALLBACK = js.Function2[js.UndefOr[js.Dynamic], js.UndefOr[js.Dynamic], Unit] def this(name: js.UndefOr[String] =…
invariant
  • 8,758
  • 9
  • 47
  • 61
0
votes
1 answer

how to define facade for a method that emits events in ScalaJS

I'm writing scalajs facade for pouchdb code : https://gist.github.com/chandu0101/62013de47bf5ee4d2412 how to define facade for API name changes which emits events and return a cancel method ..
invariant
  • 8,758
  • 9
  • 47
  • 61
0
votes
0 answers

Conflict with sbt-start-script and scala.js

I have noticed that as soon as I add scala-js to a project in which I use sbt-start-script my default settings are overwritten with scala.js specific values. Seems that once I add a reference to an object that extends the JsApp it gets set as the…
user79074
  • 4,937
  • 5
  • 29
  • 57
0
votes
2 answers

ExternalJSEnv doesn't see javascript dependencies in launcher-webpage

Simple setup : lazy val root = project.in(file(".")) .settings(scalaJSSettings: _*) .settings(utestJsSettings: _*) .settings(persistLauncher := true) .settings(persistLauncher in Test := false) .settings( name := "bindings", version…
lisak
  • 21,611
  • 40
  • 152
  • 243
0
votes
1 answer

What's the difference between object in scalajs scope and *same* object in js.global scope?

I'm trying to write a simple example to render cube with THREEJS lib. package three import org.scalajs.dom import scala.scalajs.js import scala.scalajs.js.Dynamic._ import scala.scalajs.js.annotation.JSName object THREE extends js.Object { …
roma
  • 1,512
  • 10
  • 20
0
votes
1 answer

ScalaJs PhantomJsEnv doesn't work when phantomjs is installed from npm

I am trying to use phantomjs as installed via npm to perform my unit tests for ScalaJS. When I run the tests I am getting the following error: /usr/bin/env: node: No such file or directory I believe that is because of how phatomjs when installed…
BenjaminJackman
  • 1,439
  • 1
  • 10
  • 18
0
votes
1 answer

Adding custom javascript functions to scala-js-example-app from GitHub

This is based on the scala-js-example-app from GitHub. I have a function that I want to define in Javascript and is not already defined by the Scala.js library. In my copy of the ScalaJSExample.scala file, I have: object Mine extends js.Object { …
user3025403
  • 1,070
  • 3
  • 21
  • 33
0
votes
1 answer

Creating a Scala.js Library - linking the Scala to the Javascript

I'm trying to write a new library that would work in Scala.js. I have written some of the implementations of the classes and methods in Javascript. How do I set it up so that a user can code in Scala.js (Scala)? I've looked at some Scala.js…
user3025403
  • 1,070
  • 3
  • 21
  • 33
-1
votes
2 answers

How to create an Array for Tuples in Scala?

Im trying to create an empty Array to store coordinates of an object in an Tuple which is then stored in an Array. When I try: var walls = Array[Tuple2]() Im getting this error message: kinds of the type arguments (Tuple2) do not conform to the…
TamZ
  • 27
  • 3
-1
votes
1 answer

How to differentiate between mousedown and mousedrag

I am performing some actions on onMousedown event. But then they also get executed for drag as drag starts with mouse down. How can I ensure that actions on mouse-down don't happen for mouse drag? Note: I am using scalajs-react, though that must not…
Mandroid
  • 6,200
  • 12
  • 64
  • 134
1 2 3
56
57