Giter Club home page Giter Club logo

scala-js-example-app's Introduction

Barebone application written in Scala.js -- not maintained

This repository is not maintained anymore. Consider the scala-js-tutorial repository instead, along with the actual tutorial.

This is a barebone example of an application written in Scala.js.

Get started

To get started, open sbt in this example project, and execute the task fastOptJS. This creates the file target/scala-2.12/example-fastopt.js. You can now open index-fastopt.html in your favorite Web browser!

During development, it is useful to use ~fastOptJS in sbt, so that each time you save a source file, a compilation of the project is triggered. Hence only a refresh of your Web page is needed to see the effects of your changes.

Run the tests

To run the test suite, execute the task test. If you have installed Node.js, you can use that runtime to run the tests, which is faster:

> set scalaJSStage in Global := FastOptStage
> test

The fully optimized version

For ultimate code size reduction, use fullOptJS. This will take several seconds to execute, so typically you only use this for the final, production version of your application. While index-fastopt.html refers to the JavaScript emitted by fastOptJS, index.html refers to the optimized JavaScript emitted by fullOptJS.

If Node.js is installed, the tests can also be run in their fully optimized version with:

> set scalaJSStage in Global := FullOptStage
> test

scala-js-example-app's People

Contributors

austinbgibbons avatar mikaturunen avatar rinfield avatar rladstaetter avatar sebnozzi avatar sjrd avatar twistedpair avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scala-js-example-app's Issues

Simply does not work

sbt

[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: junit#junit;4.10: configuration not found in junit#junit;4.10: 'maste
r(compile)'. Missing configuration: 'compile'. It was required from com.googleco
de.json-simple#json-simple;1.1.1 compile
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] junit:junit:4.10
[warn] +- com.googlecode.json-simple:json-simple:1.1.1
[warn] +- org.scala-js:scalajs-tools_2.10:0.6.2
[warn] +- org.scala-js:scalajs-js-envs_2.10:0.6.2
[warn] +- org.scala-js:scalajs-sbt-test-adapter_2.10:0.6.2
[warn] +- org.scala-js:sbt-scalajs:0.6.2 (scalaVersion=2.10, sbtVersi
on=0.13) (C:\Users\sstarodu\Desktop\scala-js-example-app-master\project\build.sb
t#L1-2)
[warn] +- default:scala-js-example-app-master-build:0.1-SNAPSHOT (sca
laVersion=2.10, sbtVersion=0.13)
sbt.ResolveException: unresolved dependency: junit#junit;4.10: configuration not
found in junit#junit;4.10: 'master(compile)'. Missing configuration: 'compile'.
It was required from com.googlecode.json-simple#json-simple;1.1.1 compile
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:278)
at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:175)
at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:157)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:151)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:151)
at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:128)
at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:56)
at sbt.IvySbt$$anon$4.call(Ivy.scala:64)
at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:93)
at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRet
ries$1(Locks.scala:78)
at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:

index.html references non-existant Launcher file

I'm new to Scala.js, though I think I found a bug. Running through the examples in the README.md, the tutorial works, but the referenced example-launcher.js file does not exist in target.

<script type="text/javascript" src="./target/scala-2.12/example-launcher.js"></script>

Since the tutorial appears to work without it, and since the current Scala.js intro tutorial also lacks said file, I'm wondering if it's vestigial. Also, cursory reading/hacking indicates fastOptJS and persistLauncher := true configurations that would create the launcher file are exclusive.

Error in chrome console while running example (it still show "It works!")

Uncaught TypeError: undefined is not a function Primitives.scala:79
(anonymous function)

which belongs to:

  def fromTraversableOnce[A](col: TraversableOnce[A]): Array[A] = {
    val result = new Array[A]
    col.foreach(x => result.push(x))
Uncaught TypeError: undefined is not a function
    result
  }

which in example-extdeps.js points to this line:

ScalaJS.c.scala\ufe33js\ufe33Any$$anonfun$fromTraversableOnce$1.prototype = new ScalaJS.inheritable.scala\ufe33runtime\ufe33AbstractFunction1();

I guess the references to AbstractFunction1 is bogus because that's a class that seems to be missing completely. In effect it means that definitions after this line in extdeps shouldn't work.

don't use jasmine

I was told in another ticket that jasmine is going to be dropped in favour of utest, it would be good if this skeleton therefore used utest.

optimize just hangs

sbt 0.13.6

Following the readme directions, I run sbt, then run fastOptJS it just hangs at:

[info] Fast optimizing /media/shawn/Toshiba1TB/scalaStuff/clone/target/scala-2.11/example-fastopt.js

I waited several minutes for it to complete; I certainly hope this isn't the expected experience for getting started with ScalaJS :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.