2019-09-17 21:39:06 +02:00
|
|
|
import { Collection } from 'framework/collection';
|
2020-04-15 16:50:01 +02:00
|
|
|
import { Model } from 'framework/model';
|
2015-10-17 23:49:24 +02:00
|
|
|
|
2019-09-17 21:39:06 +02:00
|
|
|
class FileCollection extends Collection {
|
2020-04-15 16:50:01 +02:00
|
|
|
static model = Model;
|
2015-10-17 23:49:24 +02:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
hasOpenFiles() {
|
2020-06-01 16:53:51 +02:00
|
|
|
return this.some((file) => file.active);
|
2019-09-17 21:39:06 +02:00
|
|
|
}
|
2015-10-17 23:49:24 +02:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
hasUnsavedFiles() {
|
2020-06-01 16:53:51 +02:00
|
|
|
return this.some((file) => file.modified);
|
2019-09-17 21:39:06 +02:00
|
|
|
}
|
2015-10-17 23:49:24 +02:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
hasDirtyFiles() {
|
2020-06-01 16:53:51 +02:00
|
|
|
return this.some((file) => file.dirty);
|
2019-09-17 21:39:06 +02:00
|
|
|
}
|
2015-12-12 09:53:50 +01:00
|
|
|
|
2019-08-18 10:17:09 +02:00
|
|
|
getByName(name) {
|
2020-06-01 16:53:51 +02:00
|
|
|
return this.find((file) => file.name.toLowerCase() === name.toLowerCase());
|
2015-10-17 23:49:24 +02:00
|
|
|
}
|
2019-09-17 21:39:06 +02:00
|
|
|
}
|
2015-10-17 23:49:24 +02:00
|
|
|
|
2019-09-15 14:16:32 +02:00
|
|
|
export { FileCollection };
|