0.10.1 (commit log)
-
Added conversions between
Callback
andFuture
.Input Method Output CallbackTo[A]
cb.toFuture
Future[A]
CallbackTo[Future[A]]
cb.toFlatFuture
Future[A]
=> Future[A]
CallbackTo(f)
CallbackTo[Future[A]]
=> Future[CallbackTo[A]]
CallbackTo.future(f)
CallbackTo[Future[A]]
=> Future[CallbackTo[A]]
Callback.future(f)
Callback
If you're looking for ways to block (eg. turning a
Callback[Future[A]]
into aCallback[A]
), it is not supported by Scala.JS (See #1996).NOTE: It's important that when going from
Future
toCallback
, you're aware of when theFuture
is instantiated.def queryServer: Future[Data] = ??? def updateComponent: Future[Callback] = queryServer.map($ setState _) // This is GOOD because the callback wraps the updateComponent *function*, not an instance. Callback.future(updateComponent) // This is BAD because the callback wraps a single instance of updateComponent. // 1) The server will be contacted immediately instead of when the callback executes. // 2) If the callback is executed more than once, the future and old result will be reused. val f = updateComponent Callback.future(f) // This is GOOD too because the future is created inside the callback. Callback.future { val f = updateComponent f.onComplete(???) f }
-
Add
CallbackOption.{pass,fail}
. -
Add
Callback{,Option}.voidExplicit
. -
Add
React.Children.toArray
. -
Upgrade React to 0.14.1. Adds new attributes:
default
kind
srcLang
-
Upgrade Scala.JS to 0.6.5.