Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
japgolly committed Nov 1, 2015
1 parent 872fb5c commit b25556e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions doc/CHANGELOG-0.10.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
| `=> Future[CallbackTo[A]]` | `Callback.future(f)` | `Callback` |
| `=> Future[CallbackTo[A]]` | `CallbackTo.future(f)` | `CallbackTo[Future[A]]` |

If you're looking for ways to block (eg. turning a `Callback[Future[A]]` into a `Callback[A]`),
it is not supported by Scala.JS (See [#1996](https://github.com/scala-js/scala-js/issues/1996)).

**NOTE:** It's important that when going from `Future` to `Callback`, you're aware of when the `Future` is instantiated.

```scala
Expand All @@ -23,7 +26,7 @@

// 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 execute more than once, the future and old result will be reused.
// 2) If the callback is executed more than once, the future and old result will be reused.
val f = updateComponent
Callback.future(f)

Expand All @@ -35,9 +38,6 @@
}
```

If you're looking for ways to block (eg. turning a `Callback[Future[A]]` into a `Callback[A]`),
it is not supported by Scala.JS (See [#1996](https://github.com/scala-js/scala-js/issues/1996)).

* Add `CallbackOption.{pass,fail}`.

* Add `Callback{,Option}.voidExplicit`.
Expand Down
8 changes: 4 additions & 4 deletions doc/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,9 @@ There are a number of conversions available to convert between `Callback` and `F
| `=> Future[CallbackTo[A]]` | `Callback.future(f)` | `Callback` |
| `=> Future[CallbackTo[A]]` | `CallbackTo.future(f)` | `CallbackTo[Future[A]]` |

If you're looking for ways to block (eg. turning a `Callback[Future[A]]` into a `Callback[A]`),
it is not supported by Scala.JS (See [#1996](https://github.com/scala-js/scala-js/issues/1996)).

**NOTE:** It's important that when going from `Future` to `Callback`, you're aware of when the `Future` is instantiated.

```scala
Expand All @@ -613,7 +616,7 @@ 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 execute more than once, the future and old result will be reused.
// 2) If the callback is executed more than once, the future and old result will be reused.
val f = updateComponent
Callback.future(f)

Expand All @@ -625,9 +628,6 @@ Callback.future {
}
```

If you're looking for ways to block (eg. turning a `Callback[Future[A]]` into a `Callback[A]`),
it is not supported by Scala.JS (See [#1996](https://github.com/scala-js/scala-js/issues/1996)).


Gotchas
=======
Expand Down

0 comments on commit b25556e

Please sign in to comment.