diff --git a/src/main/scala/org/gerweck/scalafx/util/FutureObservable.scala b/src/main/scala/org/gerweck/scalafx/util/FutureObservable.scala index e572d14..2b119da 100644 --- a/src/main/scala/org/gerweck/scalafx/util/FutureObservable.scala +++ b/src/main/scala/org/gerweck/scalafx/util/FutureObservable.scala @@ -27,7 +27,7 @@ object FutureObservable { * no equivalent mechanism for this mandatory functionality, but recovery * is already a built-in feature. */ - def apply[A](defaultValue: A)(future: Future[A])(implicit ec: ExecutionContext): ReadOnlyObjectProperty[A] = { + def withDefault[A](defaultValue: A)(future: Future[A])(implicit ec: ExecutionContext): ReadOnlyObjectProperty[A] = { future.value match { case Some(Success(a)) => ObjectProperty(a) @@ -50,6 +50,9 @@ object FutureObservable { } } + @deprecated("Use withDefault. `Apply` will be either removed or repurposed in a future release.", "0.10.2") + def apply[A](defaultValue: A)(future: Future[A])(implicit ec: ExecutionContext) = withDefault(defaultValue)(future) + /** Construct an observable that gives `None` until the `Future` completes successfully, after * which the `Option` contains the successful result. *