Sender | Message | Time |
---|---|---|
31 May 2023 | ||
project is what I meant, yeah | 16:04:14 | |
Have you looked at this https://github.com/vmunier/play-scalajs.g8 ? | 16:04:16 | |
when I said module | 16:04:18 | |
* I don't have a link but the "watch files" thing can probably be solved by having client and server be separate sbt | 16:04:25 | |
I found it here: https://www.scala-js.org/libraries/skeletons.html | 16:05:44 | |
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 | |
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 | |
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 | |
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 | |
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 | |
20:49:50 | ||
1 Jun 2023 | ||
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 | |
* 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 | |
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 | |
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 | |
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 | |
* 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 | |
* * 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 | |
I'm not familiar with vscode plugin programming so sadly I can't say anything specific really. | 10:29:45 | |
* I'm not familiar with vscode plugin programming so sadly I can't say anything specific to that really. | 10:29:49 | |
thanks a lot ! There could be so many places that it can go wrong for this tricky bug 😅 | 12:08:02 | |
15:47:18 | ||
You are not setting it right. | 18:24:21 | |
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 | ||
onComplete executes in both cases (failure/success) | 01:10:28 | |
Ah | 04:26:09 | |
But still won't if the promise never fulfills | 04:26:15 | |
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 | |
17:42:09 | ||
17:42:12 |