mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 13:39:22 +03:00
Code refactoring (2) (es5 -> es2015)
This commit is contained in:
parent
38a1041a73
commit
a2308e251b
23 changed files with 760 additions and 821 deletions
|
|
@ -1,83 +0,0 @@
|
|||
|
||||
var
|
||||
_ = require('_'),
|
||||
crossroads = require('crossroads'),
|
||||
|
||||
Utils = require('Common/Utils');
|
||||
|
||||
/**
|
||||
* @param {string} sScreenName
|
||||
* @param {?=} aViewModels = []
|
||||
* @constructor
|
||||
*/
|
||||
function AbstractScreen(sScreenName, aViewModels)
|
||||
{
|
||||
this.sScreenName = sScreenName;
|
||||
this.aViewModels = Utils.isArray(aViewModels) ? aViewModels : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {Array}
|
||||
*/
|
||||
AbstractScreen.prototype.oCross = null;
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
AbstractScreen.prototype.sScreenName = '';
|
||||
|
||||
/**
|
||||
* @type {Array}
|
||||
*/
|
||||
AbstractScreen.prototype.aViewModels = [];
|
||||
|
||||
/**
|
||||
* @returns {Array}
|
||||
*/
|
||||
AbstractScreen.prototype.viewModels = function()
|
||||
{
|
||||
return this.aViewModels;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
AbstractScreen.prototype.screenName = function()
|
||||
{
|
||||
return this.sScreenName;
|
||||
};
|
||||
|
||||
AbstractScreen.prototype.routes = function()
|
||||
{
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {?Object}
|
||||
*/
|
||||
AbstractScreen.prototype.__cross = function()
|
||||
{
|
||||
return this.oCross;
|
||||
};
|
||||
|
||||
AbstractScreen.prototype.__start = function()
|
||||
{
|
||||
var
|
||||
aRoutes = this.routes(),
|
||||
oRoute = null,
|
||||
fMatcher = null;
|
||||
|
||||
if (Utils.isNonEmptyArray(aRoutes))
|
||||
{
|
||||
fMatcher = _.bind(this.onRoute || Utils.noop, this);
|
||||
oRoute = crossroads.create();
|
||||
|
||||
_.each(aRoutes, function(aItem) {
|
||||
oRoute.addRoute(aItem[0], fMatcher).rules = aItem[1];
|
||||
});
|
||||
|
||||
this.oCross = oRoute;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = AbstractScreen;
|
||||
Loading…
Add table
Add a link
Reference in a new issue