Class: CoreLibrary

@bldr/songbook-core~CoreLibrary

The song library - a collection of songs

new CoreLibrary (songs)

Name Type Description
songs string

The base path of the song library

Members

currentSongIndex integer

The current index of the array this.songIds. Used for the methods getNextSong and getPreviousSong

songIds array

An array of song IDs.

songs object

The collection of songs

Methods

countSongs ()number

Count the number of songs in the song library

Returns:
Type Description
number

Get the next song

Returns:
Type Description
module:@bldr/songbook-core~Song

Get the previous song

Returns:
Type Description
module:@bldr/songbook-core~Song

Get a random song.

Returns:
Type Description
module:@bldr/songbook-core~Song

getSongById (songId)module:@bldr/songbook-core~Song

Get the song object from the song ID.

Name Type Description
songId string

The ID of the song. (The parent song folder)

Returns:
Type Description
module:@bldr/songbook-core~Song

sortByProperty_ (property) private

Sort alphabetically an array of objects by some specific property.

Name Type Description
property String

Key of the object to sort.

See:
Returns:
Type Description
module:@bldr/songbook-core~songs

toDynamicSelect ()array

Returns:
Type Description
array

updateCurrentSongIndex (songId)integer

Update the index of the song IDs array. If a song is opened via the search form, it is possible to go to the next or previous song of the opened song.

Name Type Description
songId string
Returns:
Type Description
integer The index in the songIds array.