Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 23 2021 09:24
    @sjrd banned @yensaoxuan_twitter
  • Apr 18 2021 19:06
    @sjrd banned @Amitgup48798297_twitter
  • Mar 29 2021 07:47
    @sjrd banned @quangs
  • Jan 23 2021 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
Sébastien Doeraene
@sjrd
Thien Do
@thien-do
Thanks!
Andrew
@andrewayres
is there anyone online who is knowledgeable about how to add a third party React component to a ScalaJS React project? (the project is based on the SPA Tutorial, and since modified a little, but essentially the same). I'd be willing to pay someone $20 via Paypal for 15mins help via a video/screen-share call (Skype, or appear.in) if there's anyone available in the next hour or two. I've read some online resources (e.g. https://github.com/chandu0101/scalajs-react-components/blob/master/doc/InteropWithThirdParty.md) and used the wrapper generator at http://chandu0101.github.io/reactjs-scalajs/ , but I'm not sure on how to include the original JS React component in the project source, nor how to reference it from ScalaJS.
Andrew
@andrewayres
@aappddeevv - only just saw your reply from 9th Nov - thanks for this suggestion. I've now successfully modified my ScalaJS React app (from the SPA tutorial) so the auto wiring retains the request context (thereby allowing me to access session cookie whenever I need to) and, as you've said, I'm just storing simple user data in scala objects for now (e.g. mutable HashMaps), as it doesn't need anything more complex at the moment
aappddeevv
@aappddeevv
I think the spa tutorial uses the older jsDependencies vs the scalajs-bundler approach. if that’s true, you need to add the lib as a jsdependency. If the spa tutorial uses scalajs-bundler then you can add it as a npm dependency.
Andrew
@andrewayres
@aappddeevv thanks
@aappddeevv and good to hear the newer approach, via scalars-bundler allows the adding of an npm dependency
aappddeevv
@aappddeevv
if you are an expert webpack person, you could put together a super quick webpack config and do it that way and avoid scalajs-bundles as well...its up to you.
S
@SRGOM
off topic but I'm wondering if nobody here Visits the "elite" (read: hipster) hacker news? I ask because there was a single mention of Scala.js on the top thread there by "somebody" when o was hoping more people would have heard of it
nafg
@nafg
@andrewayres are you still stuck?
Andrew
@andrewayres
@nafg - yes, currently working my way through dependency upgrades - are you available?
nafg
@nafg
@andrewayres I am now
Andrew
@andrewayres
@nafg great
Stefan Wachter
@swachter

I have some case classes with optional properties that I would like to share between browser and backend code. The recommended way to treat Option in the JavaScript world is to use the UndefOr class.

Ideally I would like to write to write case classes like this:

case class Data(param: Option[String] {
  def jsParam: UndefOr[String] = param.undefOr
}

However, the UndefOr class is not available in shared code because no stub is available scalajs-stubs. Does anyone know a solution (without duplicating and copying around the case classes)?

TIA
--Stefan

Thien Do
@thien-do
@swachter Hi Stefan, I think the shared case classes should still use Option. You only need to convert it to UndefOr right when you want to interact with external client API (usually the last step)
to store data or moving it around or interact with it internally (BackEnd and FrontEnd), I think it's better to keep using Option.
aappddeevv
@aappddeevv
If your backend is nodejs then you can use UndefOr everywhere.
asaadza
@asaadza
@swachter - just to add to @dvkndn 's response, which would be my first though too, also take a look at scala.scalajs.js.JSConverters
Stefan Wachter
@swachter
Thanks for your advices. Now I think that there is no way other than duplicating the classes for use in JavaScript. Several type conversions must be done (Option <--> UndefOr being one of them, Seq <-> js.Array being another one). The knock-out reason however is, that classes that are to be used in from JavaScript must extend js.Any and have several addditional restrictions.
Thien Do
@thien-do

I think those limitations are quite reasonable. Can you tell which is your problem?

Also looking at @aappddeevv I've just realized that it's possible Stefan's backend is not in Scala :joy: I didn't even think about it when reading "sharing code"

Stefan Wachter
@swachter
The backend is in Scala (i.e. Play). My pain point is that I have to repeat some definitions 3 times (the frontend is implemented in TypeScript): backend class, corresponding ScalaJS defined JavaScript type, and a TypeScript declaration file.
However, this is still a viable solution and helps to have the frontend and backend in sync.
Anton Parkhomenko
@chuwy
Hey here! Is it possible to publish a Scala library as scala.js asset if includes a Java library, by e.g. making Java lib provided and assuming that functionality requiring this code won't be used in JS?
aappddeevv
@aappddeevv
The issue of maintaining those interfaces is significant. I found that with my reasonreact like UI framework I had to ensure that anything destined for the JS side of the fence at some point had to stay scala.js friendly. That meant alot of UndefOrs. I tried to put together a fancy macro one time that could act like a real compile type lambda function that could operate on a type much like typescript which has the ability to rewrite the types of trait members to create a "new" type easily. I think that's missing from alot of statically typed languages that span different platforms that benefits from alot platform specific interop. Otherwise you have to rely on and hard to use/awkward code generators, runtime transformations/serializers or rewriting javascript libraries into scala where needed.
nafg
@nafg
This message was deleted
Ben Hutchison
@benhutchison

Is there interest in a small, shared/central Scalajs library for types defined by Typescript core, such as ReadonlyArray and PromiseLike?

Something along the lines of scalajs-dom..

When working with the Typescript to ScalajsImporter, Im noticing that it references such types, but they aren't defined anywhere, leading to duplicated copies within projects, such as this metabrowse example

Mustafa Kuscu
@mcku
I am using sbt 1.0.x and scalajs 0.6.2x. There are 4 scalajs sub projects under root. One of them is named 'clientShared' and contains code shared among the others. During a typical development session, if I edit a source file in the clientShared project, the live reload triggers concurrent compilations and/or fastOptJs tasks which get almost stuck. Then I Ctrl+C and start sbt, and invoke run task, which does not get stuck. Is it possible to put the sub module compilations in order, to complete one after another?
trepidacious
@trepidacious
@benhutchison Sounds like a good idea, anything that makes it simpler to use existing libraries in scala-js is good :)
ritschwumm
@ritschwumm
@mcku what do you mean by "almost stuck"? could it be your sbt needs more RAM?
i have a very similar setup, and usually the turnaround times are quite short
Thien Do
@thien-do
@sjrd I hope this is a small question: where can I look up to understand what do some prefixes ("$c_L", "$m_L") mean?
Mustafa Kuscu
@mcku
@ritschwumm already maxed up the memory. However reduced the thread stack size a little and now it's better a bit..
ritschwumm
@ritschwumm
how much heap memory did you give it, and how much ram do you have ? and how large is the stack size of the jvm now?
trepidacious
@trepidacious
Just looking at a facade to google apis, and I'm up to https://github.com/googleapis/google-api-nodejs-client#oauth2-client but I can't really work out how to provide a facade to const oauth2Client = new google.auth.OAuth2(...) - not really sure that OAuth2 is in that context, I guess it's an instance of a class we need to construct "reflectively" in js?
If it was just a plain function that returned OAuth2Clients that would be fine, but I don't know what magic the new brings in?
Mustafa Kuscu
@mcku
@ritschwumm physical ram is 16g. the thread stack size was 1m, now it is 768k.
Filemon279
@Filemon279
Hello guys, I'm struggling with a problem when performing sbt run. I've placed my issue on stackoverflow: https://stackoverflow.com/questions/53467366/scala-js-jsglobal-cannot-perform-run-sbt and placed my code on github:
(Sent to fast :) ) https://github.com/Filemon279/ScalaTHREEjs I would be really grateful for any help. Best!
Mustafa Kuscu
@mcku
There is a useful facade for three.js, you can check https://github.com/antonkulaga/threejs-facade
Filemon279
@Filemon279
Thanks, I've already checked it but he is using server and I do not. I've tried his code to run without server and recieved same error. I even wrote email to autor but without response (for now) :)
Filemon279
@Filemon279
I've run away from my problem with play. In Play this problem does not exist.
Kai Matsuda
@vangogh500
Any way to exclude exports from the compiled scalajs code? The reason I say this is because Electron gives you access to "require" but not exports. Right now I'm just manually removing the 2 lines below from the compiled js file to make it work:
// Where to send exports
var $e = exports;
$env["exportsNamespace"] = $e;
Sébastien Doeraene
@sjrd
@vangogh500 Er no, there's no way to do that. A CommonJS module is supposed to receive an exports, so we don't provision for the case where it's not. It's unfortunate that Electron doesn't follow the CommonJS spec.
By "manually" you mean you're post-processing it with a script/sbt task/etc., right?
aappddeevv
@aappddeevv
I seem to recall that you can post process the scalajs output with webpack using electron targets (main or renderer) and that may allow you to skip the removal step.
Andrius Bentkus
@txdv
hey guys
Screen Shot 2018-11-27 at 20.33.20.png
can someone explain to me why typescript has no strong type system?
Kai Matsuda
@vangogh500
@sjrd a little more primitive than that haha but I'll look into post-processing using sbt
Seth Tisue
@SethTisue
@txdv I'm non-expert on this so maybe someone else can help you more/better, but: types in TypeScript are optional, and the handling of variance is unsound (Microsoft/TypeScript#10717 ), plus see also https://www.typescriptlang.org/docs/handbook/type-compatibility.html
Andrius Bentkus
@txdv
They are optional ... so they are technically supported?