new Album(options)class.jsline 40
PARAMETERS
Name Type Description options
object
PROPERTIES
Name Type Description title
string
Title of album
genres
[ Array ]
Genre list of album
playTime
number = 0
Play time of all songs (unit is seconds)
active
boolean = true
Whether album is active or not
artist
object
PROPERTIES
Name Type Description name
string
Name of artist
type
[ string ]
Type of artist
debut
[ string ]
Debut daofte of artist
company
[ object ]
Company of album
PROPERTIES
Name Type Description agency
[ string ]
Agency name of album
distributor
[ string ]
Distributor name of album
EXAMPLES
const options = { title: 'รท', genres: ['Rock', 'Pop'], playTime: 3600, active: true, artist: { name: 'Ed Sheeran', type: 'Solo', debut: '2005' }, company: { agency: 'Atlantic Records UK', distributor: 'Warner Music Korea' } }; const instance = new Album(options); console.log(instance);
Static Properties
Static Methods
getDescription(album)class.jsline 100
Returns description about album.
PARAMETERS
Name Type Description album
Album
Instance of Album class
RETURNS:
{string
} - DescriptionEXAMPLES
const album1 = new Album({ // ... title: 'foo', playTime: 20 }); const album2 = new Album({ // ... title: 'bar', playTime: 60 }); Album.getDescription(album1); // "The total play time of "foo" album is 00:00:20." Album.getDescription(album2); // "The total play time of "bar" album is 00:01:00."
Instance Methods
getPlayTime(formatted)class.jsline 170
Returns play time of all songs.
PARAMETERS
Name Type Description formatted
boolean
Whether use formatted play time or not
RETURNS:
{numberstring
} - Play timeEXAMPLES
const instance = new Album({ // ... playTime: 3600 }); instance.getPlayTime(); // 3600 instance.getPlayTime(true); // "01:00:00"
Events
activeevent.jsline 1
Occurs when active state is changed.
PROPERTIES
Name Type Description title
string
Title of album
active
boolean
Active state of album
EXAMPLES
const instance = new Album({ // ... title: 'foo' }); instance.setActive(false); instance.on('active', (ev) => { const { title, active } = ev; console.log(title); // "foo" console.log(active); // false });