Permalink
Browse files

visibility and name refactors

  • Loading branch information...
felipevex committed Oct 1, 2018
1 parent 44fec0f commit b63075b4648a5569f93f1bf92109afcec3bdf9db
Showing with 13 additions and 10 deletions.
  1. +6 −4 priori/scene/PriSceneManager.hx
  2. +7 −6 priori/scene/route/RouteManager.hx
@@ -1,5 +1,6 @@
package priori.scene;
import priori.types.PriRoutePathType;
import priori.scene.route.RouteManager;
import priori.scene.view.PriPreloaderViewDefault;
import priori.scene.view.PriPreloaderView;
@@ -27,7 +28,8 @@ class PriSceneManager {
@:isVar public var holder(get, set):PriContainer;
@:isVar public var container(get, null):PriContainer;
@:isVar public var router(get, null):RouteManager;
private var router:RouteManager;
private function new() {
@@ -57,9 +59,9 @@ class PriSceneManager {
return value;
}
public function navigateToCurrent():Void {
this.router.navigateToCurrent();
}
public function addRoute(path:PriRoutePathType, scene:Class<PriSceneView>):Void this.router.addRoute(path, scene);
public function navigateToCurrent():Void this.router.navigateToCurrent();
public function reload():Void this.navigateToCurrent();
public function preload(?preloadScene:Class<PriPreloaderView>, ?onError:Void->Void, ?onComplete:Void->Void):Void {
if (preloadScene == null) preloadScene = PriPreloaderViewDefault;
@@ -44,7 +44,7 @@ class RouteManager {
this.initialized = true;
}
private function openScene(path:String):Void {
public function openScene(path:String):Void {
var item:RouteItem = this.locatePath(path);
if (item != null) {
@@ -85,19 +85,20 @@ class RouteManager {
return null;
}
private function onHashChange():Void {
public function getPathByHash():String {
var hash:String = js.Browser.location.hash;
if (StringTools.startsWith(hash, "/#/")) hash = hash.substr(3);
else if (StringTools.startsWith(hash, "#/")) hash = hash.substr(2);
else if (StringTools.startsWith(hash, "#")) hash = hash.substr(1);
this.openScene(hash);
return hash;
}
public function navigateToCurrent():Void {
this.onHashChange();
}
private function onHashChange():Void this.openScene(this.getPathByHash());
public function navigateToCurrent():Void this.onHashChange();
}
private typedef RouteItem = {

0 comments on commit b63075b

Please sign in to comment.