Cleanup and better rename settings screens to match template names

This commit is contained in:
the-djmaze 2022-03-08 00:51:32 +01:00
parent 30116c183f
commit 4dd58f7c36
83 changed files with 267 additions and 323 deletions

View file

@ -26,17 +26,14 @@ export class AbstractScreen {
* @returns {void}
*/
onStart() {
if (!this.__started) {
this.__started = true;
const routes = this.routes();
if (arrayLength(routes)) {
let route = new Crossroads(),
fMatcher = (this.onRoute || (()=>0)).bind(this);
const routes = this.routes();
if (arrayLength(routes)) {
let route = new Crossroads(),
fMatcher = (this.onRoute || (()=>0)).bind(this);
routes.forEach(item => item && route && (route.addRoute(item[0], fMatcher).rules = item[1]));
routes.forEach(item => item && route && (route.addRoute(item[0], fMatcher).rules = item[1]));
this.__cross = route;
}
this.__cross = route;
}
}
}

View file

@ -10,6 +10,7 @@ class AbstractView {
constructor(templateID, type)
{
// Object.defineProperty(this, 'viewModelTemplateID', { value: templateID });
// this.viewModelTemplateID = this.constructor.name;
this.viewModelTemplateID = templateID;
this.viewType = type;
this.viewModelDom = null;

View file

@ -278,7 +278,12 @@ export const
}
});
forEachObjectValue(SCREENS, vmScreen => vmScreen.onStart());
forEachObjectValue(SCREENS, vmScreen => {
if (!vmScreen.__started) {
vmScreen.onStart();
vmScreen.__started = true;
}
});
const cross = new Crossroads();
cross.addRoute(/^([a-zA-Z0-9-]*)\/?(.*)$/, screenOnRoute);