snappymail/dev/Knoin/AbstractModel.js
RainLoop Team ae996b75f1 Updated: dependencies
+ small fixes
2016-10-18 21:28:42 +03:00

33 lines
470 B
JavaScript

import {isArray, disposeObject} from 'Common/Utils';
export class AbstractModel
{
sModelName = '';
disposables = [];
/**
* @param {string} modelName = ''
*/
constructor(modelName = '')
{
this.sModelName = modelName || '';
}
regDisposables(value) {
if (isArray(value))
{
value.forEach((item) => {
this.disposables.push(item);
});
}
else if (value)
{
this.disposables.push(value);
}
}
onDestroy() {
disposeObject(this);
}
}