Callback

japgolly.scalajs.react.callback.Callback$package$.Callback$
object Callback

A callback with no return value. Equivalent to () => Unit.

Attributes

See also

CallbackTo

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Callback.type

Members list

Type members

Classlikes

final class ResultGuard[A]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object ResultGuard

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final class SetIntervalResult(val handle: SetIntervalHandle)

Attributes

Supertypes
class Object
trait Matchable
class Any
final class SetTimeoutResult(val handle: SetTimeoutHandle)

Attributes

Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

inline def alert(message: String): Callback

Convenience for calling dom.alert.

Convenience for calling dom.alert.

Attributes

inline def apply[A](inline f: A)(using inline ev: ResultGuard[A]): Callback
inline def assert(test: Boolean, message: String, optionalParams: Any*): Callback

Convenience for calling dom.console.assert.

Convenience for calling dom.console.assert.

Attributes

inline def debounce(delay: Duration): Callback

Creates an debounce boundary.

Creates an debounce boundary.

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

Attributes

inline def debounce(delay: FiniteDuration): Callback

Creates an debounce boundary.

Creates an debounce boundary.

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

Attributes

inline def debounceMs(delayMs: Long): Callback

Creates an debounce boundary.

Creates an debounce boundary.

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

Attributes

inline def fromJsFn(f: Function0[Unit]): Callback
inline def future[A](inline f: Future[CallbackTo[A]])(implicit ec: ExecutionContext): Callback

Wraps a Future so that it is repeatable, and so that its inner callback is run when the future completes.

Wraps a Future so that it is repeatable, and so that its inner callback is run when the future completes.

The result is discarded. To retain it, use CallbackTo.future instead.

Because the Future is discarded, when an exception causes it to fail, the exception is re-thrown. If you want the exception to be ignored or handled differently, use CallbackTo.future instead and then .void to discard the future and turn the result into a Callback.

WARNING: Futures are scheduled to run as soon as they're created. Ensure that the argument you provide creates a new Future; don't reference an existing one.

Attributes

inline def info(message: Any, optionalParams: Any*): Callback

Convenience for calling dom.console.info.

Convenience for calling dom.console.info.

Attributes

inline def lazily(inline f: Callback): Callback

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.

Attributes

inline def lift(f: () => Unit): Callback
inline def log(message: Any, optionalParams: Any*): Callback

Convenience for calling dom.console.log.

Convenience for calling dom.console.log.

Attributes

def runAll(callbacks: CallbackTo[Any]*): Callback

Run all given callbacks.

Run all given callbacks.

All results are discarded. Any exceptions get a printStackTrace and are then discarded, and the next callback run.

Attributes

Since

2.0.0

inline def sequence[T <: (Iterable), A](inline tca: T[CallbackTo[A]]): Callback
inline def sequenceOption[A](inline oca: Option[CallbackTo[A]]): Callback
inline def suspend(inline f: Callback): Callback

Callback that is recreated each time it is used.

Callback that is recreated each time it is used.

Attributes

inline def throwException(t: Throwable): Callback
def traverse[T <: (Iterable), A, B](ta: => T[A])(f: A => CallbackTo[B]): Callback
def traverseOption[A, B](oa: => Option[A])(f: A => CallbackTo[B]): Callback
inline def unless[A](inline cond: Boolean)(inline c: CallbackTo[A]): Callback

Convenience for applying a condition to a callback, and returning Callback.empty when the condition is already satisfied.

Convenience for applying a condition to a callback, and returning Callback.empty when the condition is already satisfied.

Notice the condition is strict. If non-strictness is desired use callback.unless(cond).

Value parameters

cond

The condition required to be false for the callback to execute.

Attributes

inline def warn(message: Any, optionalParams: Any*): Callback

Convenience for calling dom.console.warn.

Convenience for calling dom.console.warn.

Attributes

inline def when[A](inline cond: Boolean)(inline c: CallbackTo[A]): Callback

Convenience for applying a condition to a callback, and returning Callback.empty when the condition isn't satisfied.

Convenience for applying a condition to a callback, and returning Callback.empty when the condition isn't satisfied.

Notice the condition is strict. If non-strictness is desired use callback.when(cond).

Value parameters

cond

The condition required to be true for the callback to execute.

Attributes

Deprecated methods

def TODO: Callback

Serves as a temporary placeholder for a callback until you supply a real implementation.

Serves as a temporary placeholder for a callback until you supply a real implementation.

Unlike ??? this doesn't crash, it just prints a warning to the console.

Also it's not really deprecated; that's just so you get a compiler warning as a reminder.

Attributes

Deprecated
true
def TODO(reason: => String): Callback

Serves as a temporary placeholder for a callback until you supply a real implementation.

Serves as a temporary placeholder for a callback until you supply a real implementation.

Unlike ??? this doesn't crash, it just prints a warning to the console.

Also it's not really deprecated; that's just so you get a compiler warning as a reminder.

Attributes

Deprecated
true
inline def byName(inline f: Callback): Callback

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

Attributes

Deprecated
true
inline def error(t: Throwable): Callback

Attributes

Deprecated
true

Concrete fields

A callback that does nothing.

A callback that does nothing.

Attributes