mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 05:29:20 +03:00
ko cleaning up
This commit is contained in:
parent
fcac46f60e
commit
d8321a522e
25 changed files with 396 additions and 131 deletions
50
dev/Knoin/AbstractModel.js
Normal file
50
dev/Knoin/AbstractModel.js
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
|
||||
(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);
|
||||
};
|
||||
|
||||
module.exports = AbstractModel;
|
||||
|
||||
}());
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue