!kcOuJGXBoqBVSCYYAy:matrix.org

Scala JS

1271 Members
Scala.js, the Scala to JavaScript compiler8 Servers

Load older messages


SenderMessageTime
31 May 2023
@_discord_295204838936150018:t2bot.ioDaenyth#7233 project is what I meant, yeah 16:04:14
@_discord_448877036098813952:t2bot.iololgab#6138 Have you looked at this https://github.com/vmunier/play-scalajs.g8 ? 16:04:16
@_discord_295204838936150018:t2bot.ioDaenyth#7233 when I said module 16:04:18
@_discord_295204838936150018:t2bot.ioDaenyth#7233 * I don't have a link but the "watch files" thing can probably be solved by having client and server be separate sbt modules projects 16:04:25
@_discord_448877036098813952:t2bot.iololgab#6138 I found it here: https://www.scala-js.org/libraries/skeletons.html 16:05:44
@_discord_965670207303614505:t2bot.ioSimonHGR Thank you all, Daenyth , sjrd , lolgab . Much appreciate all the pointers. I will play (no pun intended) with these possibilities. Initially, I think it looks like the path of least resistance is probably two projects, with the scalaJSOutputDirectory configured to put the output of the ScalaJS into the web-root of the other. Heading off to experiment, again, thank you all. 16:32:23
@_discord_965670207303614505:t2bot.ioSimonHGR sjrd Sadly, I'm not as familar with sbt as I probably should be. I'm failing to define that output diretory. I've tried adding it as an entry in the .settings() part, right after the element

scalaVersion := "3.2.2"
16:58:11
@_discord_965670207303614505:t2bot.ioSimonHGR and that fails. I also tried defining it at the top level of build.sbt, right afte the imports, both with and without a "val" prefix. No joy there either. Is this something where you can easily put me back on track? 16:58:59
@_discord_965670207303614505:t2bot.ioSimonHGR Oh, and for background, I'm starting with the build.sbt copied direcly from the getting started tutorial (that's the "LiveChart" project). 16:59:53
@_discord_965670207303614505:t2bot.ioSimonHGR The error report says "Type Error", and I get that whether I set the value of scalaJSOutputDirectory to my path as a String, or as file("my path"). 17:09:20
@_discord_359056286827937794:t2bot.iowompowe joined the room.20:49:50
1 Jun 2023
@_discord_882757000197472276:t2bot.iodoofin#2121 Hi I'm wondering how to debug js promise which is not executed ? for example ,code inside foreach or complete somePromise.toFuture.foreach(... ) never get called 08:08:17
@_discord_882757000197472276:t2bot.iodoofin#2121 * Hi I'm wondering how to debug js promise which is not executed ? for example ,code inside foreach or onComplete somePromise.toFuture.foreach(... ) and somePromise.toFuture.onComplete(... ) never get called 08:09:21
@_discord_815546116066115595:t2bot.ioNikitaga#8210 In cases when a JS promise does not fire at all, you need to dig to see where the JS promise is created. I assume it's in some JS library – then yes, you'll have to dig into that library. You could find the code that creates this promise in their source on github, then try to read it to see why it might not be working. If that still does not help, you could try using the browser dev tools to put a breakpoint in the third party code that is supposed to trigger the promise.

Of course, the standard debug techniques apply as well, e.g.:
- isolate / minimize as much as possible
- make a very similar promise works in a minimal case, then try to bring that working case closer to the case that does not work, and see at which step it stops working
- check for dumb things like, are you looking at the right promise (or did you e.g. accidentally create multiple instances of a similar promise, and the one you were looking at was not triggered).
- etc.
09:56:00
@_discord_882757000197472276:t2bot.iodoofin#2121 thanks Nikitaga for the nice explanation ! The JS promise comes from Typescript library . It works for Typescript project with "await" syntax . the execution environment is vscode nodejs 10:06:47
@_discord_815546116066115595:t2bot.ioNikitaga#8210 Ah yes, you mentioned it's a vscode plugin or something like that, right. Then I would add:
- Check what EcmaScript language level that execution environment supports, and make sure Scala.js doesn't output anything newer (it has a config for that)
- Try to take scala library and ExecutionContext out of the picture. Use native JS .then method with your js.Promise in Scala.js instead of .toFuture
- Compare the JS code generated by scala.js and the JS code generated by Typescript. If there are significant differences, try to understand why, and try to remove the difference by adjusting either the typescript code or the scala.js code. One of them should either start working or start breaking.
10:25:08
@_discord_815546116066115595:t2bot.ioNikitaga#8210 * Make sure you're getting all errors and exceptions reported to you – check the execution environment's docs to see if it has any special things (like node.js has unhandledRejection event, maybe there's other similar stuff). Throw an exception in your code, or create a known failed promise to make sure you're seeing those errors somewhere in some console (without you catching those errors explicitly I mean). I assume there's some dev console where such errors go... 10:28:45
@_discord_815546116066115595:t2bot.ioNikitaga#8210 * * Make sure you're getting all errors and exceptions reported to you – check the execution environment's docs to see if it has any special features to that effect (like node.js has unhandledRejection event, maybe there's other similar stuff). Throw an exception in your code, or create a known failed promise to make sure you're seeing those errors somewhere in some console (without you catching those errors explicitly I mean). I assume there's some dev console where such errors go... 10:29:01
@_discord_815546116066115595:t2bot.ioNikitaga#8210 I'm not familiar with vscode plugin programming so sadly I can't say anything specific really. 10:29:45
@_discord_815546116066115595:t2bot.ioNikitaga#8210 * I'm not familiar with vscode plugin programming so sadly I can't say anything specific to that really. 10:29:49
@_discord_882757000197472276:t2bot.iodoofin#2121 thanks a lot ! There could be so many places that it can go wrong for this tricky bug 😅 12:08:02
@_discord_99161270892105728:t2bot.iotuzonghua joined the room.15:47:18
@_discord_1060822666719809597:t2bot.ioDavid K. You are not setting it right. 18:24:21
@_discord_192322936219238400:t2bot.ioAly It could be that the promise fires but never completes. You could be swallowing an exception somewhere too. (Foreach and onComplete iirc only execute on success) 18:41:00
2 Jun 2023
@_discord_316762215975878666:t2bot.ioAlexITC onComplete executes in both cases (failure/success) 01:10:28
@_discord_192322936219238400:t2bot.ioAly Ah 04:26:09
@_discord_192322936219238400:t2bot.ioAly But still won't if the promise never fulfills 04:26:15
@_discord_965670207303614505:t2bot.ioSimonHGR Yes, I gathered that 🙂 Any hints on how I should set it? I assumed one of the two locations I indicated would have worked, but neither does. Can you give me a hint? 15:17:57
@_discord_1022603280494379059:t2bot.iobsd changed their display name from bsd to bsd#5601.17:42:09
@_discord_1022603280494379059:t2bot.iobsd changed their display name from bsd#5601 to bsd.17:42:12

There are no newer messages yet.


Back to Room ListRoom Version: 9