Cleanup hash routing

This commit is contained in:
djmaze 2020-09-23 14:44:46 +02:00
parent 939eb0fd78
commit 3757324e32
7 changed files with 8 additions and 52 deletions

View file

@ -40,19 +40,12 @@ export class AbstractScreen {
* @returns {void}
*/
__start() {
let route = null,
fMatcher = null;
const routes = this.routes();
if (Array.isNotEmpty(routes)) {
fMatcher = (this.onRoute || (()=>{})).bind(this);
route = new Crossroads();
let route = new Crossroads(),
fMatcher = (this.onRoute || (()=>{})).bind(this);
routes.forEach((item) => {
if (item && route) {
route.addRoute(item[0], fMatcher).rules = item[1];
}
});
routes.forEach(item => item && route && (route.addRoute(item[0], fMatcher).rules = item[1]));
this.oCross = route;
}