Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 23 13:44
    @sjrd banned @BIGCRYPTO001_gitlab
  • May 01 14:31
    @sjrd banned @Certificates1_gitlab
  • Apr 22 15:31
    @sjrd banned @lerbatax
  • Jan 31 23:04
    sjrd commented #3555
  • Jan 31 22:56
    sjrd review_requested #3555
  • Jan 31 22:56
    sjrd opened #3555
  • Jan 31 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 21:06
    sjrd closed #3554
  • Jan 31 20:54
    erikvanoosten commented #2665
  • Jan 31 16:33
    sjrd commented #3538
  • Jan 31 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 15:54
    sjrd closed #3552
  • Jan 31 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 15:54
    sjrd closed #3553
  • Jan 31 15:33
    sjrd commented #2665
  • Jan 31 15:30
    erikvanoosten commented #2665
  • Jan 31 10:41
    sjrd review_requested #3554
  • Jan 31 10:41
    sjrd opened #3554
  • Jan 31 10:05
    gzm0 synchronize #3552
  • Jan 31 10:05
    gzm0 commented #3552
aappddeevv
@aappddeevv
I always thought that I should keep Option throughout my code but then I realized that for data coming from an API that is already marked as js.UndefOr, it was easier just to start using js.UndefOr for data that is always intended for a JS API. I defined an extensive amount of js.UndefOr, A|Null, js.Any, js.Object, Null, truthy and Option converters to switch between them as needed. Alot of js doc is subtly wrong about what they accept/don't accept.
Victor Ivri
@vivri
@aappddeevv these converters look like prime candidates for a companion lib :-D

Alot of js doc is subtly wrong about what they accept/don't accept.

agree!

aappddeevv
@aappddeevv
Yeah....I did define one as well as kept them part of the project. Here's the version embedded in one of my repos. The lib version is published elsewhere.
aappddeevv
@aappddeevv
I especially like when the docs say the value will be undefined, comes in as null though, and I have to use a value.toNonNullOption because the scalajslib .toOption does not check for the null as it follows scala semantics (so you can inadvertently get a Some(null)). You either wind up always using .filter or my hideous .toNonNullOption or .truthyOption, or, you model it as a UndefOr[A|Null], ...
Øyvind Raddum Berg
@oyvindberg
I've wanted a js.NullableOrUndefinedOr (with a shorter name) for a very long time too
elyphas
@elyphas
Hi, is there a way to know which html element is going to get the focus before get the focus?
Dan Di Spaltro
@dispalt
@oyvindberg same
nafg
@nafg
@elyphas why do you want that?
elyphas
@elyphas
@nafg , Because i want to hide an element when the active element transition to other element but not certain element
elyphas
@elyphas
Put it in another way if i am in a element and lost the focus i want to know which element is going to get the focus so a thirth element is going to be hide or show
ritschwumm
@ritschwumm
@elyphas https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/relatedTarget could work.
apart from that: don't do it. focus/blur events are finicky for the developer.
and - in my experience - quite often the end-result is actually confusing for the user.
elyphas
@elyphas
@ritschwumm , ok thank you
Nikita Gazarov
@raquo
I've recently learned that Scala.js supports inlining classes much like it can inline methods with @inline annotation. In Scala, value classes have certain rules for which usages will trigger the need to instantiate such classes (e.g. trying to use the value where an instance of a parent trait is expected). Are there similar rules described anywhere for Scala.js @inline classes? Are those rules fairly stable over time? We're considering an optimization in our library that relies on @inline class-es not being instantiated in a certain usage pattern. But that usage will be up to other developers so I'm wondering how fragile this optimization would be.
Sébastien Doeraene
@sjrd
@inline is a hint to the optimizer, so it never changes semantics. That means that if an instance of an inline class escapes even a method, it will be allocated.
It's best to think about it as stack allocation.
Mark Dixon
@mnd999
Is circe 0.12 supported? I'm getting Referring to non-existent method java.time.LocalDateTime$.parse
Sébastien Doeraene
@sjrd
The real question is: does Circe 0.12 support Scala.js? Which you can probably find out on their readme.
Mark Dixon
@mnd999
That's a nice way of looking at it, but probably circe is more important to scalajs than scalajs is to circe
Sébastien Doeraene
@sjrd
It's not a "nice" way of looking at it. It's the technological way of looking at it. Scala.js does not support libraries. It provides the compiler and the infrastructure necessary for projects to add Scala.js support to their build, or not. Scala.js does not have the power to support libraries, technologically speaking. It's the other way around.
Răzvan Rotaru
@roti
Hi, how can I use v1.0.0-M8-scala-2.13.0 instead of v1.0.0-M8? the sbt plugin does not seem to have a scala 2.13 version...
Travis Brown
@travisbrown
@mnd999 FWIW I think the more relevant question here is "does Scala.js support widely-used parts of the Java standard library?"
…and in the relevant case here the answer is "no" (for reasons I understand), which is why you'll need the workaround discussed here for circe 0.12+: https://github.com/circe/circe/releases/tag/v0.12.0-M4
Sébastien Doeraene
@sjrd

Hi, how can I use v1.0.0-M8-scala-2.13.0 instead of v1.0.0-M8? the sbt plugin does not seem to have a scala 2.13 version...

Use v1.0.0-M8. There is no v1.0.0-M8-scala-2.13.0 on Maven. From that tag we published v1.0.0-M8 for support of 2.13.

Răzvan Rotaru
@roti
@sjrd ok, thanks
Răzvan Rotaru
@roti

I'm new to scalajs, and I'd like to understand how JS modules are supported. In my project I have following error:

LinkingException: There were module imports without fallback to global variables, but module support is disabled.
To enable module support, set `scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule))`.

what is the typical workflow here? configuring scala-js to output one single js file, including all JS modules? or use browser friendly modules, like requirejs? (and I'm asking for the development stage, the production build is another story)

Mustafa Kuscu
@mcku
@roti are you using scalajs-bundler already?
Also, you can use its library bundling mode for faster development: see https://scalacenter.github.io/scalajs-bundler/reference.html#bundling-mode-library-only
Răzvan Rotaru
@roti
no, I just set up a project with https://github.com/vmunier/sbt-web-scalajs
Răzvan Rotaru
@roti
@mcku thank you, I managed to get it up and running.

I am now stuck in another problem. I defined a JS interface for React:

@js.native
@JSImport("react", "React")
object React extends js.Object {

  def createElement(component: String, props: Map[String, Any], children: Element*): Element = js.native

}

react is bundled in my output, so it's there, however it's not working. my object is not linked to the JS object "React".

any ideas how to debug this are greatly appreciated
aappddeevv
@aappddeevv
Try @JSImport("react", JSImport.Namespace)
You can look at other people's facades for hints as you go, slinky, scalajs-react, scalajs-reaction (and many others).
Zak Patterson
@zakpatterson
With respect to @raquo's question about @inline annotations from some 12 hours ago, does the inliner have to be explicitly enabled? Are inline annotations ignored by default and only turned on via -opt:inline and opt:l:inline? i'm trying to find some example of this, I assume we only want to enable those inlines in CI and on our releases
Ólafur Páll Geirsson
@olafurpg
Hi all! Is it expected that scalajs-tools_2.12:0.6.28 is published but not scalajs-tools_2.13:0.6.28? I'm aware that scalajs-tools has been split into io/logger/linker for v1 but I couldn't find a mention in the release notes that scalajs-tools won't be available for 2.13 on 0.6.x
Screenshot 2019-08-25 at 14.47.02.png
Context: I'm working on adding 2.13 support to mdoc and my current strategy involves dropping support for the mdoc:js modifier on 2.13
we use scalajs-tools to link code from scala code fences in markdown https://scalameta.org/mdoc/docs/js.html
Sébastien Doeraene
@sjrd
Yes, that's expected. The tools for 2.13 will only be available in 0.6.29.
The lack of release for scala-parallel-collection for 2.13 before the release of 2.13 prevented is from getting the tools ready in 0.6.28.
Ólafur Páll Geirsson
@olafurpg
Thanks for the update. I'm eagerly waiting for 0.6.29 then! :D
Sébastien Doeraene
@sjrd
Anyone wants to advance the support of Scala.js in dotty? I wrote up a tutorial to do so, linked from this meta good first issue: lampepfl/dotty#7113
Carlos Quiroz
@cquiroz
Are there specific tasks open to support dotty?
Sébastien Doeraene
@sjrd
Make it work, one test file at a time.
Carlos Quiroz
@cquiroz
:D
Sébastien Doeraene
@sjrd
Of course at some point there will be the big task of non-native JS classes (aka Scala.js-defined JS classes). But before getting there, there is a lot that can be addressed just by enabling shared tests (the ones that also work on the JVM)
Russ White
@russwyte

In a class Foo with a nested class Bar Is there are a way to create a js.constorOf[Bar] where Bar not a top level class?

When I try to do that now (in 0.6.28) I get: An undefined behavior was detected: [object Object…s not an instance of Foo at runtime - but no compile time error.

This is pretty bad for my application because the class I need the constructor for needs to be aware of it’s parent type. Any suggestions?

Russ White
@russwyte

I see this is supported in 1.0.0-M8:

https://www.scala-js.org/news/2019/06/03/announcing-scalajs-1.0.0-M8/

Is there any chance this could be applied to 0.6.x since many of my dependencies aren’t ready for 1.0.0-M8?

Sébastien Doeraene
@sjrd
No, you have to upgrade to 1.x, and encourage your dependencies to do the same.