CallbackTo

japgolly.scalajs.react.callback.CallbackTo$
See theCallbackTo companion class
object CallbackTo

Attributes

Companion
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
CallbackTo.type

Members list

Type members

Classlikes

final class LiftTraverseDsl[A, B](f: A => CallbackTo[B]) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
sealed trait MapGuard[A]

Prevents scalac discarding the result of a map function when the final result is Callback.

Prevents scalac discarding the result of a map function when the final result is Callback.

See https://github.com/japgolly/scalajs-react/issues/256

Attributes

Since

0.11.0

Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

inline def apply[A](inline f: A): CallbackTo[A]
def confirm(message: String): CallbackTo[Boolean]

Displays a modal dialog with a message and two buttons, OK and Cancel.

Displays a modal dialog with a message and two buttons, OK and Cancel.

Value parameters

message

a string to be displayed in the dialog.

Attributes

Returns

A boolean value indicating whether OK or Cancel was selected (true means OK).

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

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.

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

def lazily[A](f: => CallbackTo[A]): CallbackTo[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.

Attributes

inline def lift[A](f: () => A): CallbackTo[A]
inline def liftTraverse[A, B](f: A => CallbackTo[B]): LiftTraverseDsl[A, B]
def newJsPromise[A]: CallbackTo[(Promise[A], Try[A] => Callback)]
def prompt: CallbackTo[Option[String]]

Displays a dialog with an optional message prompting the user to input some text.

Displays a dialog with an optional message prompting the user to input some text.

Attributes

Returns

Some string comprising the text entered by the user, or None.

def prompt(message: String): CallbackTo[Option[String]]

Displays a dialog with an optional message prompting the user to input some text.

Displays a dialog with an optional message prompting the user to input some text.

Value parameters

message

a string of text to display to the user. This parameter is optional and can be omitted if there is nothing to show in the prompt window.

Attributes

Returns

Some string comprising the text entered by the user, or None.

def prompt(message: String, default: String): CallbackTo[Option[String]]

Displays a dialog with an optional message prompting the user to input some text.

Displays a dialog with an optional message prompting the user to input some text.

Value parameters

default

a string containing the default value displayed in the text input field. It is an optional parameter. Note that in Internet Explorer 7 and 8, if you do not provide this parameter, the string "undefined" is the default value.

message

a string of text to display to the user. This parameter is optional and can be omitted if there is nothing to show in the prompt window.

Attributes

Returns

Some string comprising the text entered by the user, or None.

inline def pure[A](a: A): CallbackTo[A]
def retryUntilRight[L, R](attempt: CallbackTo[Either[L, R]])(onLeft: L => Callback): CallbackTo[R]
inline def sequence[T <: (Iterable), A](inline tca: T[CallbackTo[A]])(implicit cbf: BuildFrom[T[CallbackTo[A]], A, T[A]]): CallbackTo[T[A]]

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

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

Attributes

inline def sequenceOption[A](inline oca: Option[CallbackTo[A]]): CallbackTo[Option[A]]

Sequence Option over CallbackTo. Co-sequence CallbackTo over Option.

Sequence Option over CallbackTo. Co-sequence CallbackTo over Option.

Attributes

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

Callback that is recreated each time it is used.

Callback that is recreated each time it is used.

Attributes

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

Tail-recursive callback. Uses constant stack space.

Tail-recursive callback. Uses constant stack space.

Based on Phil Freeman's work on stack safety in PureScript, described in Stack Safety for Free.

Attributes

inline def throwException[A](t: Throwable): CallbackTo[A]
def traverse[T <: (Iterable), A, B](ta: => T[A])(f: A => CallbackTo[B])(implicit cbf: BuildFrom[T[A], B, T[B]]): CallbackTo[T[B]]

Traverse stdlib T over CallbackTo. Distribute CallbackTo over stdlib T.

Traverse stdlib T over CallbackTo. Distribute CallbackTo over stdlib T.

Attributes

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

Traverse Option over CallbackTo. Distribute CallbackTo over Option.

Traverse Option over CallbackTo. Distribute CallbackTo over Option.

Attributes

def windowOpen(url: String, noopener: Boolean, focus: Boolean): CallbackTo[Window]

When executed, opens a new window (tab) to a given URL.

When executed, opens a new window (tab) to a given URL.

Value parameters

focus

Whether or not to focus the new window.

noopener

See https://developers.google.com/web/tools/lighthouse/audits/noopener

Attributes

Deprecated methods

def TODO[A](result: => A): CallbackTo[A]

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[A](result: => A, reason: => String): CallbackTo[A]

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 byName[A](f: => CallbackTo[A]): CallbackTo[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

Attributes

Deprecated
true

Concrete fields

lazy val currentTimeMillis: CallbackTo[Long]
lazy val nanoTime: CallbackTo[Long]
lazy val now: CallbackTo[Instant]

Givens

Givens

inline given MapGuard[A]: MapGuard[A]

Extensions

Extensions

extension [A](self: CallbackTo[Option[A]])(self: CallbackTo[Option[A]])
inline def asCBO: CallbackOption[A]
extension [A, B](self: CallbackTo[A => B])(self: CallbackTo[A => B])
def distFn: A => CallbackTo[B]

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

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

Attributes

extension [A, B](self: CallbackTo[(A, B)])(self: CallbackTo[(A, B)])
inline def flatMap2[C](f: (A, B) => CallbackTo[C]): CallbackTo[C]
extension [A](self: CallbackTo[A])(self: CallbackTo[A])
def to[F[_]](implicit F: Sync[F]): F[A]

Deprecated extensions

extension (self: CallbackTo[Boolean])(self: CallbackTo[Boolean])
inline def !: CallbackTo[Boolean]

Negates the callback result (so long as it's boolean).

Negates the callback result (so long as it's boolean).

Attributes

Deprecated
true
def &&(b: CallbackTo[Boolean]): CallbackTo[Boolean]

Creates a new callback that returns true when both this and the given callback return true.

Creates a new callback that returns true when both this and the given callback return true.

Attributes

Returns a CallbackOption that requires the boolean value therein to be true.

Returns a CallbackOption that requires the boolean value therein to be true.

Attributes

inline def unary_!: CallbackTo[Boolean]

Negates the callback result (so long as it's boolean).

Negates the callback result (so long as it's boolean).

Attributes

def ||(b: CallbackTo[Boolean]): CallbackTo[Boolean]

Creates a new callback that returns true when either this or the given callback return true.

Creates a new callback that returns true when either this or the given callback return true.

Attributes