japgolly.scalajs.react.callback

Members list

Type members

Classlikes

object AsyncCallback

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final class AsyncCallback[+A] extends AnyVal

Pure asynchronous callback.

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:

A good example is the Ajax 2 demo.

Type parameters

A

The type of data asynchronously produced on success.

Attributes

Companion
object
Supertypes
class AnyVal
trait Matchable
class Any
Self type
object Callback

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

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

Attributes

See also

CallbackTo

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

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final class CallbackOption[+A](val underlyingRepr: () => A) extends AnyVal

Callback that can short-circuit along the way when conditions you specify, aren't met.

Callback that can short-circuit along the way when conditions you specify, aren't met.

Especially useful for event handlers such as key handlers, drag-and-drop handlers, etc, where you check a condition, perform an effect, check another condition, perform another effect, etc.

This is meant to be lightweight, and be immediately useful without the typical pain of imports, implicit conversions and extension methods then normally accompany monad transforms in Scala.

For a more generic (i.e. beyond Option) or comprehensive monad transformer use Cats or similar.

Attributes

Companion
object
Supertypes
class AnyVal
trait Matchable
class Any
Self type
object CallbackTo

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
CallbackTo.type
final class CallbackTo[+A](val trampoline: Trampoline[A]) extends AnyVal

A function to be executed later, usually by scalajs-react in response to some kind of event.

A function to be executed later, usually by scalajs-react in response to some kind of event.

The purpose of this class is to lift effects into the type system, and use the compiler to ensure safety around callbacks (without depending on an external library like Cats).

() => Unit is replaced by Callback. Similarly, ReactEvent => Unit is replaced by ReactEvent => Callback.

Type parameters

A

The type of result produced when the callback is invoked.

Attributes

Since

0.10.0

Companion
object
Supertypes
class AnyVal
trait Matchable
class Any
Self type
trait Exports

Attributes

Supertypes
class Object
trait Matchable
class Any
object RateLimit

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
RateLimit.type
final class SyncPromise[A]

Promise that is synchronous once its value has been set.

Promise that is synchronous once its value has been set.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object SyncPromise

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
trait Timer

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object RealTimer.type
object Timer

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Timer.type

Types

type Callback = CallbackTo[Unit]