mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 12:09:20 +03:00
ES2015 first look / babeljs
This commit is contained in:
parent
5dcceaaca5
commit
445cd155e5
123 changed files with 3214 additions and 3680 deletions
|
|
@ -1,76 +0,0 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
Utils = require('Common/Utils')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AbstractComponent()
|
||||
{
|
||||
this.disposable = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {Array}
|
||||
*/
|
||||
AbstractComponent.prototype.disposable = [];
|
||||
|
||||
AbstractComponent.prototype.dispose = function ()
|
||||
{
|
||||
_.each(this.disposable, function (fFuncToDispose) {
|
||||
if (fFuncToDispose && fFuncToDispose.dispose)
|
||||
{
|
||||
fFuncToDispose.dispose();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {*} ClassObject
|
||||
* @param {string} sTemplateID
|
||||
* @return {Object}
|
||||
*/
|
||||
AbstractComponent.componentExportHelper = function (ClassObject, sTemplateID) {
|
||||
var oComponent = {
|
||||
viewModel: {
|
||||
createViewModel: function(oParams, oComponentInfo) {
|
||||
|
||||
oParams = oParams || {};
|
||||
oParams.element = null;
|
||||
|
||||
if (oComponentInfo.element)
|
||||
{
|
||||
oParams.component = oComponentInfo;
|
||||
oParams.element = $(oComponentInfo.element);
|
||||
|
||||
require('Common/Translator').i18nToNodes(oParams.element);
|
||||
|
||||
if (!Utils.isUnd(oParams.inline) && ko.unwrap(oParams.inline))
|
||||
{
|
||||
oParams.element.css('display', 'inline-block');
|
||||
}
|
||||
}
|
||||
|
||||
return new ClassObject(oParams);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
oComponent['template'] = sTemplateID ? {
|
||||
element: sTemplateID
|
||||
} : '<b></b>';
|
||||
|
||||
return oComponent;
|
||||
};
|
||||
|
||||
module.exports = AbstractComponent;
|
||||
|
||||
}());
|
||||
Loading…
Add table
Add a link
Reference in a new issue