These are chat archives for japgolly/scalacss

22nd
Apr 2015
interesting approach to rethinking css
pete hunt being the guy who created reactjs
i particularly like how he allows you to write the style on the element, and it gets transformed into a style in the stylesheet
very useful for one off styles
Matt Hughes
@matthughes
Apr 22 2015 17:45
@japgolly objections to this change?
diff --git a/core/src/main/scala/japgolly/scalajs/react/vdom/Extra.scala b/core/src/main/scala/japgolly/scalajs/react/vdom/Extra.scala
index 111ab99..d07cd3e 100644
--- a/core/src/main/scala/japgolly/scalajs/react/vdom/Extra.scala
+++ b/core/src/main/scala/japgolly/scalajs/react/vdom/Extra.scala
@@ -17,7 +17,7 @@ object Extra {
   }

   final class AttrExt(val _a: Attr) extends AnyVal {
-    @inline def -->(callback: => Unit) = _a := ((() => callback): js.Function)
+    @inline def -->(callback: => Unit) = _a := ((callback _): js.Function)
I’m trying to write athrottle function to dampen events:
def throttle0(callback: Function0[Unit], processInitial: Boolean = false, limit: FiniteDuration = 100.millis): Function0[Unit]
But it isn’t working correctly because —> puts a wrapper around it
David Barri
@japgolly
Apr 22 2015 20:26
@matthughes No nothing is changed with that patch. callback _ is exactly the same as () => callback
> cat as.scala 
class Test {
 def a(f: => Unit) = () => f
 def b(f: => Unit) = f _
}

> javap -c -public -cp . Test   
Compiled from "as.scala"
public class Test {
  public scala.Function0<scala.runtime.BoxedUnit> a(scala.Function0<scala.runtime.BoxedUnit>);
    Code:
       0: aload_1
       1: areturn

  public scala.Function0<scala.runtime.BoxedUnit> b(scala.Function0<scala.runtime.BoxedUnit>);
    Code:
       0: aload_1
       1: areturn
}