Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 08 20:43
    @sjrd banned @sw7240614
  • Sep 29 2019 08:35
    @sjrd banned @8bitpitRBX_twitter
  • May 23 2019 13:44
    @sjrd banned @BIGCRYPTO001_gitlab
  • May 01 2019 14:31
    @sjrd banned @Certificates1_gitlab
  • Apr 22 2019 15:31
    @sjrd banned @lerbatax
  • Jan 31 2019 23:04
    sjrd commented #3555
  • Jan 31 2019 22:56
    sjrd review_requested #3555
  • Jan 31 2019 22:56
    sjrd opened #3555
  • Jan 31 2019 21:06

    sjrd on 0.6.x

    Remove dead code: specific coll… Adapt the signature of `js.Arra… Merge pull request #3554 from s… (compare)

  • Jan 31 2019 21:06
    sjrd closed #3554
  • Jan 31 2019 20:54
    erikvanoosten commented #2665
  • Jan 31 2019 16:33
    sjrd commented #3538
  • Jan 31 2019 15:54

    sjrd on master

    Fix analyzer cycle detection to… Add toString methods to analyze… Do not provide linked ClassInfo… and 1 more (compare)

  • Jan 31 2019 15:54
    sjrd closed #3552
  • Jan 31 2019 15:54

    sjrd on master

    Remove Logger.success It is un… Make level helpers final Clean-up ScalaConsoleLogger cod… and 1 more (compare)

  • Jan 31 2019 15:54
    sjrd closed #3553
  • Jan 31 2019 15:33
    sjrd commented #2665
  • Jan 31 2019 15:30
    erikvanoosten commented #2665
  • Jan 31 2019 10:41
    sjrd review_requested #3554
  • Jan 31 2019 10:41
    sjrd opened #3554
Jason Pickens
@steinybot
Is there a sjsir decompiler?
Jason Pickens
@steinybot

How does Scala.js include native JavaScript? I have a class:

@JSGlobal
@js.native
class Sortable(element: HTMLElement,  options: js.Any = js.native) extends js.Object {
  def destroy(): Unit = js.native
}

This was working fine when I was using WebJars and now that I am trying to use scalajs-bundler with NPM it no longer works. I guess the actual fix is probably something to do with scalajs-bundler but I don’t even know how it is supposed to work.

By not working I mean it fails at runtime with:
MainTabs.scala:36 Uncaught TypeError: $g.Sortable is not a constructor
Sébastien Doeraene
@sjrd
There is, it's called scalajsp and is available in any Scala.js project from sbt as theJSProject/scalajsp some.Class
Jason Pickens
@steinybot
Cool, I’ll check that out sometime. Thanks.
Sébastien Doeraene
@sjrd
With scalajs-bundler you need to @JSImport things from the libraries you're using. @JSGlobal looks things up in the global scope, but scalajs-bundler would dead code eliminate them.
Jason Pickens
@steinybot
Oh right. Yeah that makes sense. Thanks again :).
Jason Pickens
@steinybot
Cool that sorted it. Let’s see how long my limited JS knowledge holds up.
tuerfight
@tuerfight
Is there a length limit for nodelist in scala.js?
Tobias Schlatter
@gzm0
What is nodelist?
Tobias Schlatter
@gzm0
Scala.js does not impose any limit. But the DOM implementation (or specification) might.
tuerfight
@tuerfight
I put many <div> into a nodelist using querySelectorAll(".slide").asInstanceOf[NodeListOf[html.Div]]and try to control each node of it show and notshow on page using scala.js(using basic style.display="block"..), the issue is that the node stop showing after the tenth node in the nodelist, I check my method logic many times it's right so I think maybe there is a limit of showing nodes in nodelist.
Tobias Schlatter
@gzm0
Does the HTML inspector (in your browser) reflect the changes you are trying to make?
NodeList should definitely support more than 10 nodes.
tuerfight
@tuerfight
I write 12 <div> in the html file and I use console.log(nodelist.length) to check the length and it's right 12, but when I check HTML inspector in chrome it's only shows ten <div> the rest two is missing , I don't know why....
tuerfight
@tuerfight

this is my scala.js code below:

    var slides = dom.document.querySelectorAll(".slide").asInstanceOf[NodeListOf[html.Div]]
    console.log("slides length is: "+slides.length)

and this is chrome html inspector shows:

截屏2020-11-26 22.32.51.png
截屏2020-11-26 22.33.12.png
I write 12 div, the node length is right but the inspector only find 10 div, where goes wrong?
Domas Poliakas
@domaspoliakas
Could there be elements with the slide class elsewhere on the page?
tuerfight
@tuerfight
I find it!
There is some miss in my code with close tag of div to let two divs become other's child div...
fixed it.
@domaspoliakas @gzm0 thanks!!
maybe recently I'm too tired ┑( ̄▽  ̄)┍..
Dave Smith
@davesmith00000
Fun little problem cross compiling a Scala.js facade between 2.13.4 and 3.0.0-M2 - just wondering if this is a known thing:
In 2.13.4, I had this on a facade and all was well:
final val COLOR_ATTACHMENT15: Int = 0x8cef
Scala 3 says "Ah ha! That's not allowed on a facade, you can only say js.native" - which makes total sense.
Scala 3 is now happy with:
final val COLOR_ATTACHMENT15: Int = js.native
Cross compiling back to Scala 2.13.4 (with fatal warnings), and the compiler fails with a dead code warning.
So it seems I can't cross compile at the moment - is that right?
(Otherwise Scala 3.0.0-M2 appears to be working with Scala.js just fine so far!)
Sébastien Doeraene
@sjrd
Dead code warnings have been broken since forever in Scala 2.x wrt = js.native definitions. At least with recent 2.13 you can @nowarn them away.
Dave Smith
@davesmith00000
Ok thank you
Erik Bruchez
@ebruchez

Hi all I am trying to figure out how to fix an sbt/Scala.js out of memory error. On fullLinkJS, I am getting messages like:

In the last 10 seconds, 7.052 (70.6%) were spent in GC. [Heap: 0.95GB free of 2.90GB, max 2.90GB] Consider increasing the JVM heap using `-Xmx` or try a different collector, e.g. `-XX:+UseG1GC`, for better performance.

I am trying to increase memory with SBT_OPTS, sbt -J-Xmx8G, sbt -mem 8000, and still it seems my heap is set to 2.9 GB. Is there a different setting that applies to fullLinkJS?

Using the latest Scala.js and sbt, by the way.
Alexis Hernandez
@AlexITC
Try creating .sbtopts on the project, with:

-J-Xmx4G
-J-XX:MaxMetaspaceSize=4G
-J-XX:+CMSClassUnloadingEnabled
Erik Bruchez
@ebruchez
Ha you know what: I already had an .sbtopts file , and it had -Xmx3G. Changing that worked, thanks :) Interesting that sbt takes that before anything else.
Sakib Hadžiavdić
@sake92
Hello! Is it possible to get something like Thread.currentThread().getStackTrace() in ScalaJS ?
Sébastien Doeraene
@sjrd
Yes, with Thread.currentThread().getStackTrace() ;)
Sakib Hadžiavdić
@sake92
Ah... I was calling it inside a method, so didnt get full stack trace.. (probably called asynchronously or something) :sweat_smile:
When called in constructor I got what I wanted. Thx! :D
nemrA
@nemrA81309171_twitter
Hi, is it possible to build a scalajs project using gradle? I know there is a plugin but it is (as stated) for version 0.6 while scalajs is on version 1.3+ already. I am wondering if there is a way to invoke the scalajs compiler without using sbt?
I have also found examples where there is a "shell script that runs sbt" but it is limited to linux. Our dev environment is on windows so I would like ideally a solution with gradle that has no os dependency
Sébastien Doeraene
@sjrd
If you want gradle support, your best bet is probably to fork that plugin and update it for Scala.js 1.3+.
I don't think anyone ever cared enough about gradle + Scala.js to maintain a plugin.
nemrA
@nemrA81309171_twitter
I see, that may be beyond my capabilities, thanks for the quick reply.
Anton Sviridov
@keynmol

@sjrd at the end of the day the invocation of compiler and linker is an invocation of the scala compiler with the scalajs-compiler set as plugin, right?

That's what I got from running sbt -debug on the project. Are there any extra steps?

Sébastien Doeraene
@sjrd
The compiler, yes. The linker, that's a different thing.
The linker is usually called as an API call.
We have scalajs-cli to bind that API call to a top-level main method, but we hardly maintain it.
Still, it might be possible to link the artifact for scalajs-cli with the latest scalajs-linker for things to work.
Anton Sviridov
@keynmol
There's also the bloop link which I'm still yet to contribute support for 1.1+ for :(
Lorenzo Gabriele
@lolgab
@keynmol I did a similar thing for mill. When I have time I have to try if I can fix it on bloop too..
Anton Sviridov
@keynmol

My eventual dream is to have scalajs packaging support for ammonite.

Which are all sides of the same coin -> invoke compiler with correct dependencies and invoke linker through library call