Pure asynchronous callback.
You can think of this as being similar to using Future
- you can use it in for-comprehensions the same way - except AsyncCallback
is pure and doesn't need an ExecutionContext
.
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:
The following methods are effectively parallel:
In 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.
Type parameters
- A
-
The type of data asynchronously produced on success.
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
class AnyValtrait Matchableclass Any
- Self type
Members list
Value members
Concrete methods
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 this.
Attributes
Start both this and the given callback at once and when both have completed successfully, discard the value produced by the given callback.
Start both this and the given callback at once and when both have completed successfully, discard the value produced by the given callback.
Attributes
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.
Attributes
Convenient version of <<
that accepts an Option
Convenient version of <<
that accepts an Option
Attributes
Alias for tap
.
Alias for tap
.
Attributes
Sequence the argument a callback to run after this, discarding any value produced by this.
Sequence the argument a callback to run after this, discarding any value produced by this.
Attributes
Alias for flatMap
.
Alias for flatMap
.
Attributes
Wraps this callback in a try-catch and returns either the result or the exception if one occurs.
Wraps this callback in a try-catch and returns either the result or the exception if one occurs.
Attributes
Creates an debounce boundary over the underlying computation.
Creates an debounce boundary over the underlying computation.
Save the result of this as a val
somewhere because it relies on internal state that must be reused.
Attributes
Creates an debounce boundary over the underlying computation.
Creates an debounce boundary over the underlying computation.
Save the result of this as a val
somewhere because it relies on internal state that must be reused.
Attributes
Creates an debounce boundary over the underlying computation.
Creates an debounce boundary over the underlying computation.
Save the result of this as a val
somewhere because it relies on internal state that must be reused.
Attributes
Runs this async computation in the background.
Runs this async computation in the background.
Unlike fork_ this returns an AsyncCallback[Unit]
instead of a Callback
.
Attributes
Function distribution. See AsyncCallback.liftTraverse(f).id
for the dual.
Function distribution. See AsyncCallback.liftTraverse(f).id
for the dual.
Attributes
Wraps this callback in a try-finally
block and runs the given callback in the finally
clause, after the current callback completes, be it in error or success.
Wraps this callback in a try-finally
block and runs the given callback in the finally
clause, after the current callback completes, be it in error or success.
Attributes
Wraps this callback in a try-finally
block and runs the given callback in the finally
clause, after the current callback completes, be it in error or success.
Wraps this callback in a try-finally
block and runs the given callback in the finally
clause, after the current callback completes, be it in error or success.
Attributes
Runs this async computation in the background.
Runs this async computation in the background.
Returns the ability for you to await/join the forked computation.
Attributes
Runs this async computation in the background.
Runs this async computation in the background.
Unlike fork this returns nothing, meaning this is like fire-and-forget.
Attributes
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.
Attributes
Log the duration of this callback's execution.
Log the duration of this callback's execution.
Attributes
Log the duration of this callback's execution.
Log the duration of this callback's execution.
Value parameters
- name
-
Prefix to appear the log output.
Attributes
Log the duration of this callback's execution.
Log the duration of this callback's execution.
Attributes
Logs the result of this callback as it completes.
Logs the result of this callback as it completes.
Attributes
Logs the result of this callback as it completes.
Logs the result of this callback as it completes.
Value parameters
- name
-
Prefix to appear the log output.
Attributes
Logs the result of this callback as it completes.
Logs the result of this callback as it completes.
Attributes
Return a version of this callback that will only execute once, and reuse the result for all other invocations.
Return a version of this callback that will only execute once, and reuse the result for all other invocations.
Attributes
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.
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.
Attributes
Limits the number of invocations in a given amount of time.
Limits the number of invocations in a given amount of time.
Attributes
- Returns
-
Some if invocation was allowed, None if rejected/rate-limited
Limits the number of invocations in a given amount of time.
Limits the number of invocations in a given amount of time.
Attributes
- Returns
-
Some if invocation was allowed, None if rejected/rate-limited
Limits the number of invocations in a given amount of time.
Limits the number of invocations in a given amount of time.
Attributes
- Returns
-
Some if invocation was allowed, None if rejected/rate-limited
Limits the number of invocations in a given amount of time.
Limits the number of invocations in a given amount of time.
Attributes
- Returns
-
Some if invocation was allowed, None if rejected/rate-limited
Limits the number of invocations in a given amount of time.
Limits the number of invocations in a given amount of time.
Attributes
- Returns
-
Some if invocation was allowed, None if rejected/rate-limited
If this completes successfully, discard the result. If any exception occurs, call printStackTrace
and continue.
If this completes successfully, discard the result. If any exception occurs, call printStackTrace
and continue.
Attributes
- Since
-
2.0.0
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
.
Attributes
Schedule for repeated execution every dur
.
Schedule for repeated execution every dur
.
Attributes
Schedule for repeated execution every dur
.
Schedule for repeated execution every dur
.
Attributes
Schedule for repeated execution every x milliseconds.
Schedule for repeated execution every x milliseconds.
Attributes
Schedule for execution after dur
.
Schedule for execution after dur
.
Schedule for execution after x milliseconds.
Schedule for execution after x milliseconds.
Note: it most cases delayMs is a better alternative.
Attributes
Returns a synchronous Callback that when run, returns the result on the Right if this AsyncCallback is actually synchronous, else returns a new AsyncCallback on the Left that waits for the async computation to complete.
Returns a synchronous Callback that when run, returns the result on the Right if this AsyncCallback is actually synchronous, else returns a new AsyncCallback on the Left that waits for the async computation to complete.
Attributes
When the callback result becomes available, perform a given side-effect with it.
When the callback result becomes available, perform a given side-effect with it.
Attributes
Limit the amount of time you're prepared to wait for a computation.
Limit the amount of time you're prepared to wait for a computation.
Note: there's no built-in concept of cancellation here. If your procedure doesn't finish in time, this will return None
when the time limit is reached however, the underlying procedure will become orphaned and continue to run in the background until complete.
Attributes
Limit the amount of time you're prepared to wait for a computation.
Limit the amount of time you're prepared to wait for a computation.
Note: there's no built-in concept of cancellation here. If your procedure doesn't finish in time, this will return None
when the time limit is reached however, the underlying procedure will become orphaned and continue to run in the background until complete.
Attributes
Limit the amount of time you're prepared to wait for a computation.
Limit the amount of time you're prepared to wait for a computation.
Note: there's no built-in concept of cancellation here. If your procedure doesn't finish in time, this will return None
when the time limit is reached however, the underlying procedure will become orphaned and continue to run in the background until complete.
Attributes
THIS IS VERY CONVENIENT IN UNIT TESTS BUT DO NOT RUN THIS IN PRODUCTION CODE.
THIS IS VERY CONVENIENT IN UNIT TESTS BUT DO NOT RUN THIS IN PRODUCTION CODE.
Executes this now, expecting and returning a synchronous result. If there are any asynchronous computations this will throw an exception.
Attributes
Discard the value produced by this callback.
Discard the value produced by this callback.
Attributes
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).
Attributes
Conditional execution of this callback.
Conditional execution of this callback.
Value parameters
- cond
-
The condition required to be
true
for this callback to execute.
Attributes
- Returns
-
Some
result of the callback executed, elseNone
.
Conditional execution of this callback. Discards the result.
Conditional execution of this callback. Discards the result.
Value parameters
- cond
-
The condition required to be
true
for this callback to execute.
Attributes
Record the duration of this callback's execution.
Record the duration of this callback's execution.
Attributes
Alias for map
.
Alias for map
.