TimerSupportF

japgolly.scalajs.react.extra.TimerSupportF
See theTimerSupportF companion object
trait TimerSupportF[F[_]] extends OnUnmountF[F]

Alternatives to window.setTimeout/window.setInterval that automatically unregister installed callbacks when the component unmounts.

Provides interval methods that guarentee duration between callbacks. Regular use of setInterval is fine for callbacks with determined execution time. However, if your callback could possibly take as long or longer than your timeout, you can end up with callbacks firing back to back.

Install in ScalaComponent.build via .configure(TimerSupport.install).

Attributes

Companion
object
Graph
Supertypes
trait OnUnmountF[F]
class Object
trait Matchable
class Any
Known subtypes
Self type

Members list

Value members

Concrete methods

final def setGuaranteedInterval[G[_]](f: G[Unit], interval: FiniteDuration)(implicit G: Dispatch[G]): F[Unit]

Provides setInterval-like behavior insuring that the time between calls of f is at least the timeout.

Provides setInterval-like behavior insuring that the time between calls of f is at least the timeout.

Attributes

final def setGuaranteedIntervalMs[G[_]](f: G[Unit], intervalInMilliseconds: Double)(implicit G: Dispatch[G]): F[Unit]

Provides setInterval-like behavior insuring that the time between calls of f is at least the timeout.

Provides setInterval-like behavior insuring that the time between calls of f is at least the timeout.

Attributes

final def setInterval[G[_]](f: G[Unit], period: FiniteDuration)(implicit G: Dispatch[G]): F[Unit]

Invokes the callback f repeatedly every period.

Invokes the callback f repeatedly every period.

Attributes

final def setIntervalMs[G[_]](f: G[Unit], periodInMilliseconds: Double)(implicit G: Dispatch[G]): F[Unit]
final def setTimeout[G[_]](f: => G[Unit], timeout: FiniteDuration)(implicit G: Dispatch[G]): F[Unit]

Invokes the callback f once after a minimum of timeout elapses.

Invokes the callback f once after a minimum of timeout elapses.

Attributes

final def setTimeoutMs[G[_]](f: => G[Unit], timeoutInMilliseconds: Double)(implicit G: Dispatch[G]): F[Unit]

Invokes the callback f once after a minimum of timeout elapses.

Invokes the callback f once after a minimum of timeout elapses.

Attributes

Inherited methods

final def onUnmount[G[_]](f: => G[Unit])(implicit G: Dispatch[G]): F[Unit]

Attributes

Inherited from:
OnUnmountF
final def unmount: F[Unit]

Attributes

Inherited from:
OnUnmountF