mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-08 07:48:02 +08:00
27 lines
464 B
JavaScript
27 lines
464 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);
|
|
}
|
|
}
|