mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-06-29 01:36:44 +03:00
Let all the new CollectionModels use AbstractCollectionModel
This commit is contained in:
parent
086a2c1927
commit
71f6fb25e5
5 changed files with 39 additions and 44 deletions
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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue