AsyncCallback

Companion:
class
class Object
trait Matchable
class Any

Type members

Classlikes

final class Barrier(val await: AsyncCallback[Unit], completePromise: Callback)
final class CountDownLatch(count: Int, barrier: Barrier)
final case class Forked[+A](await: AsyncCallback[A], isComplete: CallbackTo[Boolean])
final class Mutex
final class ReadWriteMutex
final class Ref[A]
final class State

Types

type UnderlyingRepr[+A] = State => Try[A] => Callback => Callback

Value members

Concrete methods

def apply[A](f: Try[A] => Callback => Callback): AsyncCallback[A]
def awaitAll(as: AsyncCallback[Any]*): AsyncCallback[Unit]
inline def const[A](t: Try[A]): AsyncCallback[A]

A synchronization aid that allows you to wait until a set of async processes completes.

A synchronization aid that allows you to wait until a set of async processes completes.

inline def debounce(delay: Duration): AsyncCallback[Unit]

Creates an debounce boundary.

Creates an debounce boundary.

Save it as a val somewhere because it relies on internal state that must be reused.

inline def debounce(delay: FiniteDuration): AsyncCallback[Unit]

Creates an debounce boundary.

Creates an debounce boundary.

Save it as a val somewhere because it relies on internal state that must be reused.

inline def debounceMs(delayMs: Long): AsyncCallback[Unit]

Creates an debounce boundary.

Creates an debounce boundary.

Save it as a val somewhere because it relies on internal state that must be reused.

def delay[A](a: => A): AsyncCallback[A]
def first[A](f: Try[A] => Callback => Callback): AsyncCallback[A]
def fromCallbackToFuture[A](c: CallbackTo[Future[A]])(using ec: ExecutionContext): AsyncCallback[A]
def fromFuture[A](fa: => Future[A])(using ec: ExecutionContext): AsyncCallback[A]
def fromJsPromise[A](pa: => Thenable[A]): AsyncCallback[A]
def init[A, B](f: Try[B] => Callback => CallbackTo[A]): CallbackTo[(A, AsyncCallback[B])]
def lazily[A](f: => AsyncCallback[A]): AsyncCallback[A]

Callback that isn't created until the first time it is used, after which it is reused.

Callback that isn't created until the first time it is used, after which it is reused.

Creates a new (non-reentrant) mutex.

Creates a new (non-reentrant) mutex.

def never[A]: AsyncCallback[A]

AsyncCallback that never completes.

AsyncCallback that never completes.

def promise[A]: CallbackTo[(AsyncCallback[A], Try[A] => Callback)]

Create an AsyncCallback and separately provide the completion function.

Create an AsyncCallback and separately provide the completion function.

This is like Scala's promise, not the JS promise which is more like Scala's Future.

def pure[A](a: A): AsyncCallback[A]

Creates a new (non-reentrant) read/write mutex.

Creates a new (non-reentrant) read/write mutex.

inline def ref[A]: CallbackTo[Ref[A]]
def ref[A](allowStaleReads: Boolean, atomicWrites: Boolean): CallbackTo[Ref[A]]
def sequence[T <: (Iterable), A](tca: => T[AsyncCallback[A]])(using cbf: BuildFrom[T[AsyncCallback[A]], A, T[A]]): AsyncCallback[T[A]]

Sequence stdlib T over AsyncCallback. Co-sequence AsyncCallback over stdlib T.

Sequence stdlib T over AsyncCallback. Co-sequence AsyncCallback over stdlib T.

def sequenceOption[A](oca: => Option[AsyncCallback[A]]): AsyncCallback[Option[A]]

Sequence Option over AsyncCallback. Co-sequence AsyncCallback over Option.

Sequence Option over AsyncCallback. Co-sequence AsyncCallback over Option.

def sequenceOption_[A](oca: => Option[AsyncCallback[A]]): AsyncCallback[Unit]

Same as sequenceOption except avoids combining return values.

Same as sequenceOption except avoids combining return values.

def sequence_[T <: (Iterable), A](tca: => T[AsyncCallback[A]]): AsyncCallback[Unit]

Same as sequence except avoids combining return values.

Same as sequence except avoids combining return values.

def suspend[A](f: => AsyncCallback[A]): AsyncCallback[A]

Callback that is recreated each time it is used.

Callback that is recreated each time it is used.

https://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_name

def tailrec[A, B](a: A)(f: A => AsyncCallback[Either[A, B]]): AsyncCallback[B]

Not literally tail-recursive because AsyncCallback is continuation-based, but this utility in this shape may still be useful.

Not literally tail-recursive because AsyncCallback is continuation-based, but this utility in this shape may still be useful.

def throwException[A](t: => Throwable): AsyncCallback[A]
def throwExceptionWhenDefined(o: => Option[Throwable]): AsyncCallback[Unit]
def traverse[T <: (Iterable), A, B](ta: => T[A])(f: A => AsyncCallback[B])(using cbf: BuildFrom[T[A], B, T[B]]): AsyncCallback[T[B]]

Traverse stdlib T over AsyncCallback. Distribute AsyncCallback over stdlib T.

Traverse stdlib T over AsyncCallback. Distribute AsyncCallback over stdlib T.

def traverseOption[A, B](oa: => Option[A])(f: A => AsyncCallback[B]): AsyncCallback[Option[B]]

Traverse Option over AsyncCallback. Distribute AsyncCallback over Option.

Traverse Option over AsyncCallback. Distribute AsyncCallback over Option.

def traverseOption_[A, B](oa: => Option[A])(f: A => AsyncCallback[B]): AsyncCallback[Unit]

Same as traverseOption except avoids combining return values.

Same as traverseOption except avoids combining return values.

def traverse_[T <: (Iterable), A, B](ta: => T[A])(f: A => AsyncCallback[B]): AsyncCallback[Unit]

Same as traverse except avoids combining return values.

Same as traverse except avoids combining return values.

def viaCallback(onCompletion: Callback => Callback): AsyncCallback[Unit]

Deprecated methods

@deprecated("Use AsyncCallback.suspend", "2.0.0")
def byName[A](f: => AsyncCallback[A]): AsyncCallback[A]

Callback that is recreated each time it is used.

Callback that is recreated each time it is used.

https://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_name

Deprecated
@deprecated("Use c.asAsyncCallback", "")
Deprecated
@deprecated("Use AsyncCallback.delay", "1.7.0")
def point[A](a: => A): AsyncCallback[A]
Deprecated

Concrete fields

A synchronisation aid that allows you to wait for another async process to complete.

A synchronisation aid that allows you to wait for another async process to complete.

val unit: AsyncCallback[Unit]

Extensions

Extensions

extension [A, B](self: AsyncCallback[A => B])
def distFn: A => AsyncCallback[B]

Function distribution. See AsyncCallback.liftTraverse(f).id for the dual.

Function distribution. See AsyncCallback.liftTraverse(f).id for the dual.