All Downloads are FREE. Search and download functionalities are using the official Maven repository.

japgolly.webapputil.browser.WindowConfirm.scala Maven / Gradle / Ivy

There is a newer version: 2.0.0-RC12
Show newest version
package japgolly.webapputil.browser

import japgolly.scalajs.react.{CallbackTo, Reusability}

/** Abstraction over `window.confirm`. */
trait WindowConfirm {
  def apply(msg: String): CallbackTo[Boolean]
}

object WindowConfirm {

  val real: WindowConfirm =
    CallbackTo.confirm(_)

  def const(b: Boolean): WindowConfirm =
    const(CallbackTo.pure(b))

  def const(cb: CallbackTo[Boolean]): WindowConfirm =
    _ => cb

  implicit def reusability: Reusability[WindowConfirm] =
    Reusability.byRef
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy