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
If I understand correctly, this means that we can have e.g. val div = htmlTag("div") instead of it being a lazy val, and if you never use div-s in your app, div won't be included in the JS bundle, similar to how it works today with lazy vals.
This would be great for us because having a hundred lazy vals for all the tags and properties that you use obviously comes with some overhead, and even if it's not really noticeable, it would be great to simplify.
However, we need to test whether the Scala.js optimizer is smart enough to recognize our implementations of def htmlTag as "pure", and thus removable, otherwise we won't win anything. For Laminar the implementation instantiates a class HtmlTag which inherits from a trait with two public val-s, the constructor doesn't do anything else other than set those vals. For Outwatch and other consuming libraries, I'm not sure, but I suspect it's something similar. I'm hoping all our implementations are pure enough.
The text was updated successfully, but these errors were encountered:
Scala DOM Types now leaves this choice to the library starting with 17.x, so I am marking this issue as discussion only, there's nothing actionable in SDT.
If you try any approaches that aren't lazy val in your library, please let me know how it went.
Scala.js 1.11 (news) now removes unused fields.
If I understand correctly, this means that we can have e.g.
val div = htmlTag("div")
instead of it being a lazy val, and if you never use div-s in your app, div won't be included in the JS bundle, similar to how it works today with lazy vals.This would be great for us because having a hundred lazy vals for all the tags and properties that you use obviously comes with some overhead, and even if it's not really noticeable, it would be great to simplify.
However, we need to test whether the Scala.js optimizer is smart enough to recognize our implementations of
def htmlTag
as "pure", and thus removable, otherwise we won't win anything. For Laminar the implementation instantiates aclass HtmlTag
which inherits from a trait with two public val-s, the constructor doesn't do anything else other than set those vals. For Outwatch and other consuming libraries, I'm not sure, but I suspect it's something similar. I'm hoping all our implementations are pure enough.The text was updated successfully, but these errors were encountered: