Start both this and the given callback at once and when both have completed successfully, discard the value produced by this.
Start both this and the given callback at once and when both have completed successfully, discard the value produced by the given callback.
Sequence a callback to run before this, discarding any value produced by it.
Sequence a callback to run before this, discarding any value produced by it.
Convenient version of <<
that accepts an Option
Alias for tap
.
Alias for tap
.
Sequence the argument a callback to run after this, discarding any value produced by this.
Alias for flatMap
.
Alias for flatMap
.
Wraps this callback in a try-catch and returns either the result or the exception if one occurs.
Function distribution.
Function distribution. See AsyncCallback.liftTraverse(f).id
for the dual.
Log to the console before this callback starts, and after it completes.
Log to the console before this callback starts, and after it completes.
Does not change the result.
Logs the result of this callback as it completes.
Logs the result of this callback as it completes.
Logs the result of this callback as it completes.
Prefix to appear the log output.
Logs the result of this callback as it completes.
Return a version of this callback that will only execute once, and reuse the result for all other invocations.
Start both this and the given callback at once use the first result to become available, regardless of whether it's a success or failure.
Discard the callback's return value, return a given value instead.
Discard the callback's return value, return a given value instead.
ret
, short for return
.
When the callback result becomes available, perform a given side-effect with it.
Conditional execution of this callback.
Conditional execution of this callback. Reverse of when().
The condition required to be false
for this callback to execute.
Some
result of the callback executed, else None
.
Conditional execution of this callback.
Conditional execution of this callback. Discards the result. Reverse of when_().
The condition required to be false
for the callback to execute.
Discard the value produced by this callback.
Discard the value produced by this callback.
Discard the value produced by this callback.
This method allows you to be explicit about the type you're discarding (which may change in future).
Conditional execution of this callback.
Conditional execution of this callback.
The condition required to be true
for this callback to execute.
Some
result of the callback executed, else None
.
Conditional execution of this callback.
Conditional execution of this callback. Discards the result.
The condition required to be true
for this callback to execute.
Alias for map
.
Alias for map
.
Pure asynchronous callback.
You can think of this as being similar to using
Future
- you can use it in for-comprehensions the same way - exceptAsyncCallback
is pure and doesn't need anExecutionContext
.When combining instances, it's good to know which methods are sequential and which are parallel (or at least concurrent).
The following methods are sequential: - >>=() / flatMap() - >>() & <<() - flatTap()
The following methods are effectively parallel: - *>() & <*() - race() - zip() & zipWith() -
AsyncCallback.traverse
et alIn order to actually run this, or get it into a shape in which in can be run, use one of the following: - toCallback <-- most common - asCallbackToFuture - asCallbackToJsPromise - unsafeToFuture() - unsafeToJsPromise()
A good example is the [Ajax 2 demo](https://japgolly.github.io/scalajs-react/#examples/ajax-2).
The type of data asynchronously produced on success.