From c7ef15293569266b08ed7f61ce8a462140721e79 Mon Sep 17 00:00:00 2001 From: chandu0101 Date: Sat, 3 Feb 2018 02:24:36 +0530 Subject: [PATCH] update to scalajs 1.0.0-M3 --- build.sbt | 10 +++++----- project/build.properties | 2 +- project/plugins.sbt | 2 +- src/main/scala/sri/web/router/RouterCtrl.scala | 18 ++++++++++++++++++ 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/build.sbt b/build.sbt index 2fffb9d..70edd96 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,6 @@ name := "web-router" -//version := "2017.12.0-SNAPSHOT" +//version := "2018.1.0-SNAPSHOT" enablePlugins(ScalaJSPlugin) @@ -21,8 +21,8 @@ scalacOptions ++= Seq( //deps libraryDependencies ++= Seq( - "scalajs-react-interface" %%% "core" % "2017.12.28-RC" % Provided, - "scalajs-react-interface" %%% "universal" % "2017.12.28-RC" % Provided) + "scalajs-react-interface" %%% "core" % "2018.2.2-RC" % Provided, + "scalajs-react-interface" %%% "universal" % "2018.2.2-RC" % Provided) //bintray resolvers += Resolver.jcenterRepo @@ -75,8 +75,8 @@ resolvers ++=Seq(Resolver.bintrayRepo("scalajs-react-interface", "maven"), libraryDependencies ++= Seq( "org.scala-js" %%% "scalajs-dom" % "0.9.4" % Test, - "scalajs-jest" %%% "core" % "2017.12.27-RC" % Test, - "scalajs-react-interface" %%% "web" % "2017.12.28-RC" % Test + "scalajs-jest" %%% "core" % "2018.2.2-RC" % Test, + "scalajs-react-interface" %%% "web" % "2018.2.2-RC" % Test ) //scalaJSStage in Global := FastOptStage scalaJSStage in Global := FullOptStage diff --git a/project/build.properties b/project/build.properties index cd928ea..266acc6 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1,2 +1,2 @@ -sbt.version=1.0.4 +sbt.version=1.1.0 diff --git a/project/plugins.sbt b/project/plugins.sbt index 392b7d9..78cdab1 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.0.0-M2") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.0.0-M3") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0") addSbtPlugin("com.dwijnand" % "sbt-dynver" % "2.0.0") addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.2") diff --git a/src/main/scala/sri/web/router/RouterCtrl.scala b/src/main/scala/sri/web/router/RouterCtrl.scala index 013bdca..eedf82c 100644 --- a/src/main/scala/sri/web/router/RouterCtrl.scala +++ b/src/main/scala/sri/web/router/RouterCtrl.scala @@ -88,6 +88,24 @@ final class RouterCtrl private[router] (val history: History, } } + /** + * use this method to navigate to static pages using screenKey + */ + def navigateWithKey(screenKey: RouterScreenKey, + action: NavigationAction = NavigationAction.PUSH, + search: js.UndefOr[String] = js.undefined, + ) = { + config.staticRoutes.get(screenKey.toString) match { + case Some(route) => { + val location = + new Location(pathname = route.path, search = search) + if (action == NavigationAction.REPLACE) history.replace(location) + else history.push(location) + } + case None => handleNotFound() + } + } + def navigateBack() = history.goBack() def navigateForward() = history.goForward()