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

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

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

import japgolly.scalajs.react._
import japgolly.webapputil.general.Url
import org.scalajs.dom.window

trait WindowLocation {
  def setHref        (url: Url.Absolute): Callback
  def setHrefRelative(url: Url.Relative): Callback
}

object WindowLocation {

  object Real extends WindowLocation {
    private[this] def set(href: String) = Callback {
      window.location.href = href
    }

    override def setHref        (url: Url.Absolute) = set(url.absoluteUrl)
    override def setHrefRelative(url: Url.Relative) = set(url.relativeUrl)
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy