mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-06-28 23:05:54 +00:00
Let all the new CollectionModels use AbstractCollectionModel
This commit is contained in:
15
dev/Model/AbstractCollection.js
Normal file
15
dev/Model/AbstractCollection.js
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
export class AbstractCollectionModel extends Array
|
||||
{
|
||||
constructor(props) {
|
||||
super();
|
||||
props && Object.entries(props).forEach(([key, value]) => '@' !== key[0] && (this[key] = value));
|
||||
// props[@Count]
|
||||
}
|
||||
|
||||
static getFromJSON(object, name) {
|
||||
return object && 'Collection/'+name === object['@Object'] && Array.isArray(object['@Collection'])
|
||||
? object['@Collection']
|
||||
: null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user