mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 05:29:20 +03:00
Code refactoring (es5 -> es2015)
This commit is contained in:
parent
fb2e492ce8
commit
38a1041a73
42 changed files with 3081 additions and 3690 deletions
34
dev/Knoin/AbstractModel.jsx
Normal file
34
dev/Knoin/AbstractModel.jsx
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
|
||||
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};
|
||||
Loading…
Add table
Add a link
Reference in a new issue