mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-05 22:42:25 +08:00
34 lines
510 B
JavaScript
34 lines
510 B
JavaScript
|
|
import _ from '_';
|
|
import {isArray, disposeObject} from 'Common/Utils';
|
|
|
|
class AbstractModel
|
|
{
|
|
/**
|
|
* @param {string} modelName
|
|
*/
|
|
constructor(modelName)
|
|
{
|
|
this.sModelName = modelName || '';
|
|
this.disposables = [];
|
|
}
|
|
|
|
regDisposables(value) {
|
|
if (isArray(value))
|
|
{
|
|
_.each(value, (item) => {
|
|
this.disposables.push(item);
|
|
});
|
|
}
|
|
else if (value)
|
|
{
|
|
this.disposables.push(value);
|
|
}
|
|
}
|
|
|
|
onDestroy() {
|
|
disposeObject(this);
|
|
}
|
|
}
|
|
|
|
export {AbstractModel, AbstractModel as default};
|