Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 18 19:06
    @sjrd banned @Amitgup48798297_twitter
  • Mar 29 07:47
    @sjrd banned @quangs
  • Jan 23 06:34
    @sjrd banned @Rebeka58_gitlab
  • Jun 08 2020 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
Kirill A. Korinsky
@catap
Hey, is it possible to understand in runtime when some object exists? For example org.scalajs.dom.raw.Touch or athing very rare inside org.scalajs.dom?
Sébastien Doeraene
@sjrd
Sure: js.typeOf(js.Dynamic.global.Touch) != "undefined"
Kirill A. Korinsky
@catap
@sjrd thanks, I've played with js.undefined and can't figure it out.
Kirill A. Korinsky
@catap
@sjrd following question. Let assume that I'd like to check that const net = require('net'); is possible. How can I do it?
ah, I see
Sébastien Doeraene
@sjrd
Same as in JS: check that require exists, then try/catch.
Kirill A. Korinsky
@catap
js.typeOf(js.Dynamic.global.require) != "undefined"
Eric K Richardson
@ekrich
@sjrd Any chance that regex code will be useful for Scala Native?
Sébastien Doeraene
@sjrd
Absolutely not. It's a compiler from Java regex to JS regex. It's only useful if you have a JS regex engine to begin with.
William Narmontas
@ScalaWilliam

Hi all, I could not find the right way to do this - how do you do this in Scala.js?

import 'codemirror/mode/clike/clike';

It's a side-effecting import

Sébastien Doeraene
@sjrd
With an @JSImport("codemirror/mode/clike/clike", JSImport.Namespace) object Foo extends js.Any, and then you make sure that actually reach Foo, e.g., by putting it in your main method, or any other code that will run in all the cases where you need those side effects to have been executed.
William Narmontas
@ScalaWilliam
thank you @sjrd !
Mat Fournier
@mat4nier_twitter
:wave: what's everyone's preferred way to do websockets in scalajs? Curious what my options are floating around.
Antoine Doeraene
@sherpal
It really depends in what context you want to use them. But for me, since I'm working with the Laminar framework, I like to wrap the websockets inside "event stream" and "observers". (Usually by adding an automatic layer with decoders and encoders, such as, for example, circe (when speed is not an issue but debugging is) or boopickle (when speed is an issue and debugging is not)).
Brandon Elam Barker
@bbarker
is it possible to use scala-js-dom from Scala 3 by some means, currently?
Mat Fournier
@mat4nier_twitter
@sherpal thanks. Already using laminar so I'll go look into that.
1 reply
Sakib Hadžiavdić
@sake92
@bbarker yes with ("org.scala-js" %%% "scalajs-dom" % "1.1.0").cross(CrossVersion.for3Use2_13)
Kirill A. Korinsky
@catap
@sjrd another fast and wired question. How can I use js.FunctionN in scala 2.11? Naive approcach fails with scalac error: The argument types of an anonymous function must be fully known. (SLS 8.5)
new js.Function1[js.UndefOr[js.Error], Unit] {...} fails with A non-native JS class cannot declare a concrete method named apply without @JSName
Sébastien Doeraene
@sjrd
You have to explicitly write the parameter types of your anonymous function, that's all.
So not (x, y) => x + y but (x: Int, y: Int) => x + y
Or use the -Xexperimental option of scalac 2.11, if you feel adventurous.
Kirill A. Korinsky
@catap
got it, thanks
Hanns Holger Rutz
@Sciss
which one is more effective to transfer via XHR and decompress in sjs, jar or zip?
Sébastien Doeraene
@sjrd
@Sciss Hum, I don't think I understand the question.
jar and zip are exactly the same thing. You can rename a .jar into a .zip and you'll be able to open it.
Hanns Holger Rutz
@Sciss
I thought they were "more or less" the same thing, didn't know they are exactly the same. So in SJS I would just use java.util.JarInputStream, and that would work? Or is there a better and more direct mapping to underlying JavaScript API for that?
Sébastien Doeraene
@sjrd
That would work if JarInputStream were implemented at all, but that's not the case (at least not in the core repo).
Hanns Holger Rutz
@Sciss
Ok. So I would have to use JS API to decompress?
Sébastien Doeraene
@sjrd
If you want to read a zip/jar file in Scala.js, consider using a JS library like jszip.
Hanns Holger Rutz
@Sciss
Got it, thanks
Brandon Elam Barker
@bbarker
thanks @sake92 !
Hanns Holger Rutz
@Sciss
why would this happen in fastOptJS but not fullOptJS:
org.scalajs.linker.runtime.UndefinedBehaviorError: java.lang.ClassCastException: 0.019759721189251594 is not an instance of java.lang.Integer
Sébastien Doeraene
@sjrd
@Sciss Because that's literally the role of fastOpt: https://www.scala-js.org/doc/semantics.html#undefined-behaviors
Sakib Hadžiavdić
@sake92
Would it be possible to warn on %% dependencies in ScalaJS-only projects?
It happened to me a few times due to copy-paste :smile:
Andriy Plokhotnyuk
@plokhotnyuk
@sake92 Compile-time only dependencies work fine with %% or % for Scala.js projects.
2 replies
Sébastien Doeraene
@sjrd
Tomorrow at 4:30 CEST, discover my take on the best features of Scala 3 for Scala.js users:
It will happen at the following YouTube link, and I'll be in the chat section to answer comments: https://youtu.be/llGtGd4qux0
Anton Sviridov
@velvetbaldmime:matrix.org
[m]

That was great, thanks @sjrd !

The opaque pattern is very cool - and probably would have a good effect on the size of the generated code with all those classes removed?

Sébastien Doeraene
@sjrd
Thanks :)
The generated code will be exactly the same. traits that extend js.Any have no footprint JS.
August Nagro
@AugustNagro
Great talk Sebastien, learned some new things. I'm a big fan of the anonymous class inference for config objects.. the 'two lookup' problem is one of my biggest annoyances with using any compile-to-js language.
Sébastien Doeraene
@sjrd
Thanks :)
Andrew Adams
@adamsar
Hey I just checked out the video, learned some good stuff thanks. I also felt like I got a personal shout out with the | syntax gitter part ;)
Sébastien Doeraene
@sjrd
The video was recorded a month ago. It was not targeted at a single example. It has been the most common question here for the past 5 years.
Andrew Adams
@adamsar
Hopefully will no longer be the top question soon!
Sébastien Doeraene
@sjrd
Yup ;)