Code refactoring

Flow first look
This commit is contained in:
RainLoop Team 2016-09-10 01:38:16 +03:00
parent 2f841524cb
commit e6e0b02849
71 changed files with 2092 additions and 1836 deletions

View file

@ -5,9 +5,12 @@ import {isArray, isNonEmptyArray, noop} from 'Common/Utils';
class AbstractScreen
{
oCross = null;
sScreenName;
aViewModels;
constructor(screenName, viewModels = [])
{
this.oCross = null;
this.sScreenName = screenName;
this.aViewModels = isArray(viewModels) ? viewModels : [];
}
@ -54,8 +57,11 @@ class AbstractScreen
fMatcher = _.bind(this.onRoute || noop, this);
route = crossroads.create();
_.each(routes, (aItem) => {
route.addRoute(aItem[0], fMatcher).rules = aItem[1];
_.each(routes, (item) => {
if (item && route)
{
route.addRoute(item[0], fMatcher).rules = item[1];
}
});
this.oCross = route;