mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-08 07:48:02 +08:00
e6e0b02849
Flow first look
36 lines
533 B
JavaScript
36 lines
533 B
JavaScript
|
|
import _ from '_';
|
|
import {isArray, disposeObject} from 'Common/Utils';
|
|
|
|
class AbstractModel
|
|
{
|
|
sModelName = '';
|
|
disposables = [];
|
|
|
|
/**
|
|
* @param {string} modelName = ''
|
|
*/
|
|
constructor(modelName = '')
|
|
{
|
|
this.sModelName = modelName || '';
|
|
}
|
|
|
|
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};
|