snappymail/dev/Knoin/AbstractModel.js
RainLoop Team 6116597f6f Many fixes
New ownCloud package with a built-in webmail
2015-02-12 01:41:07 +04:00

51 lines
783 B
JavaScript

(function () {
'use strict';
var
_ = require('_'),
Utils = require('Common/Utils')
;
/**
* @constructor
*
* @param {string} sModelName
*/
function AbstractModel(sModelName)
{
this.sModelName = sModelName || '';
this.disposables = [];
}
/**
* @param {Array|Object} mInputValue
*/
AbstractModel.prototype.regDisposables = function (mInputValue)
{
if (Utils.isArray(mInputValue))
{
_.each(mInputValue, function (mValue) {
this.disposables.push(mValue);
}, this);
}
else if (mInputValue)
{
this.disposables.push(mInputValue);
}
};
AbstractModel.prototype.onDestroy = function ()
{
Utils.disposeObject(this);
// window.console.log('onDestroy: ' + this.sModelName); // TODO
};
module.exports = AbstractModel;
}());