You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's pretend for the sake of this issue, I'm an impatient ninja coder who can't be bothered to read any documentation.
<impatient ninja coder>
I copy paste the sbt libraryDependencies line, then the code example. I doesn't compile. What imports am I missing?
Because I'm a hipster dev who lives on #twitter and stack overflow, I use VS Code as "IDE" which is of no help. I start looking for tests. Where are they? I move on to the javadocs. Hosted javadocs, great! But… what is this? jsdom and generic? builders, codecs, defs? What do I import now? I randomly import both jsdom._ and generic._ to no avail.
I am left with this:
org.scalajs.dom.html.Div does not take parameters
val meow = div(
^
I give up, because I am impatient and just wanted to save time in the first place and I don't want to go down yet another rabbit hole. </impatient ninja coder>
The text was updated successfully, but these errors were encountered:
phdoerfler
changed the title
Add imports to code example
More complete code example
Apr 4, 2022
If you are trying to use Scala DOM Types as an end user, you probably want to use Laminar instead (which uses this library under the hood). Add "com.raquo" %%% "laminar" % "0.14.2" to sbt libraryDependencies, and see the complete Hello world example (or just go straight to running laminar-examples locally). This section of the docs elaborates more on imports – it's generally just one line and you don't need to import anything from Scala DOM Types directly.
As is mentioned in the docs, Scala DOM Types itself does not actually offer the div(attr := value) syntax, it is a low level library designed for other libraries to use, so it is up to the consuming library (such as Laminar) to implement such syntax. If you are trying to build your own library based on Scala DOM Types, then look at how Laminar uses Scala DOM Types internally, starting with the Laminar.scala file. Detailed documentation on that is missing due to lack of time and availability of several example implementations (Laminar, Outwatch, ff4s)
Let's pretend for the sake of this issue, I'm an impatient ninja coder who can't be bothered to read any documentation.
<impatient ninja coder>
I copy paste the sbt libraryDependencies line, then the code example. I doesn't compile. What imports am I missing?
Because I'm a hipster dev who lives on #twitter and stack overflow, I use VS Code as "IDE" which is of no help. I start looking for tests. Where are they? I move on to the javadocs. Hosted javadocs, great! But… what is this? jsdom and generic? builders, codecs, defs? What do I import now? I randomly import both jsdom._ and generic._ to no avail.
I am left with this:
I give up, because I am impatient and just wanted to save time in the first place and I don't want to go down yet another rabbit hole.
</impatient ninja coder>
The text was updated successfully, but these errors were encountered: