Constructor
new Folder(library, row) → {Folder}
Create a new Folder class.
Parameters:
Name | Type | Description |
---|---|---|
library |
PhotosLibrary | An instance of PhotosLibrary used for album fetching. |
row |
Object | A database row from RKFolder. |
Returns:
The generated Folder instance.
- Type
- Folder
Members
albums :Array.<Album>
The Albums located in this Folder.
Will only be initialized after initFolder() is called!
Type:
- Array.<Album>
cloudId :string
The cloud ID of the Folder. (database field: cloudIdentifier).
Type:
- string
created :Date
The date the Folder was created. (database field: createDate).
The database value is converted from a Apple Core Data date to a Javascript Date object.
Type:
- Date
folders :Array.<Folder>
The sub-Folders located in this Folder.
Will only be initialized after initFolder()
is called!
Type:
- Array.<Folder>
id :int
The ID of the Folder in the database (database field: modelId).
Type:
- int
library :PhotosLibrary
The library used for media fetching.
Type:
- PhotosLibrary
magic :Bool
A Folder is magic if it is generated by Apple Photos and not by the user (e.g. Favorites).
Type:
- Bool
name :string
The name of the Folder. (database field: name).
Type:
- string
parentFolderUuid :string
The uuid of the parent Folder the Folder is in. (database field: folderUuid).
Type:
- string
synced :Bool
Wether or not the folder has been synced to iCloud. (database field: hasBeenSynced).
Type:
- Bool
uuid :string
The uuid of the Folder in the database (database field: uuid).
Type:
- string
Methods
countAlbums() → {int}
Count all the albums in this folder.
This will recursively call the same function on all subfolders to get a true total.
Returns:
Total amount of Albums in the Folder (including subfolders).
- Type
- int
(async) initFolder()
Initialize this folder and load Albums and sub-Folders.
This method needs to be called in order for the albums and folders properties to be populated.
toJSON() → {Object}
Prepare the Folder for JSON serialization.
This function is needed to exclude the library property from JSON serialization.
Returns:
The filtered object.
- Type
- Object