Class: PhotoSource

PhotoSource

A potential source of photos for the screen saver


new PhotoSource(useKey, photosKey, type, desc, isDaily, isArray [, loadArg])

Create a new photo source

Parameters:
Name Type Argument Default Description
useKey string

The key for if the source is selected

photosKey string

The key for the collection of photos

type string

A descriptor of the photo source

desc string

A human readable description of the source

isDaily boolean

Should the source be updated daily

isArray boolean

Is the source an Array of photo Arrays

loadArg Object <optional>
<nullable>
null

optional arg for load function

Source:

Methods


<static> addPhoto(photos, url, author, asp [, ex] [, point])

Add a app.PhotoSource.Photo to an existing Array

Parameters:
Name Type Argument Description
photos Array

app.PhotoSource.Photo Array

url string

The url to the photo

author string

The photographer

asp number

The aspect ratio of the photo

ex Object <optional>

Additional information about the photo

point string <optional>

'lat lon'

Source:

<static> createSource(useKey) → {app.PhotoSource}

Factory Method to create a new app.PhotoSource

Parameters:
Name Type Description
useKey app.PhotoSources.UseKey

photo source useKey

Source:
Returns:

a new PhotoSource or subclass

Type
app.PhotoSource

<private> _savePhotos(photos) → {string}

Save the photos to localStorage in a safe manner

Parameters:
Name Type Description
photos Array.<app.PhotoSource.Photo>
Source:
Returns:

non-null on error

Type
string

<abstract> fetchPhotos() → {Promise.<Array.<app.PhotoSource.Photo>>}

Fetch the photos for this source - override

Source:
Returns:

Array of photos

Type
Promise.<Array.<app.PhotoSource.Photo>>

getPhotos() → {app.PhotoSource.Photos}

Get the photos from local storage

Source:
Returns:

the photos

Type
app.PhotoSource.Photos

isDaily() → {boolean}

Get if we should update daily

Source:
Returns:

if true, update daily

Type
boolean

process() → {Promise.<void>}

Process the photo source.

Source:
Returns:

void

Type
Promise.<void>

use() → {boolean}

Determine if this source has been selected for display

Source:
Returns:

true if selected

Type
boolean

Type Definitions


Photo

A photo from a app.PhotoSource This is the photo information that is persisted.

Type:
  • Object
Properties:
Name Type Argument Description
url string

The url to the photo

author string

The photographer

asp number

The aspect ratio of the photo

ex Object <optional>

Additional information about the photo

point string <optional>

geolocation 'lat lon'

Source:

Photos

The photos for a app.PhotoSource

Type:
  • Object
Properties:
Name Type Description
type string

type of app.PhotoSource

photos Array.<app.PhotoSource.Photo>

The photos

Source: