Skip to content

Commit

Permalink
new methods for priscene manager
Browse files Browse the repository at this point in the history
  • Loading branch information
felipevex committed Dec 5, 2018
1 parent 72cd05e commit 64c2ac8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions priori/scene/PriSceneManager.hx
Expand Up @@ -100,6 +100,15 @@ class PriSceneManager {
AssetManager.g().load();
}

public function updatePath(path:String):Void {

if (StringTools.startsWith(path,"/")) path = "#" + path;
else path = "#/" + path;

js.Browser.window.history.replaceState({}, "", path);

}

public function navigate(path:String):Void {
if (StringTools.startsWith(path,"/")) path = "#" + path;
else path = "#/" + path;
Expand All @@ -111,6 +120,11 @@ class PriSceneManager {
}
}

public function replaceAndNavigate(path:String):Void {
this.updatePath(path);
this.navigateToCurrent();
}

@:allow(priori.scene.route.RouteManager)
private function changeScene(newScene:PriSceneView):Void {
if (this.currentScene != null) {
Expand Down

0 comments on commit 64c2ac8

Please sign in to comment.