logo

/Doc|v1.1.1

Class

new Album(options)class.jsline 40

PARAMETERS
NameTypeDescription

options

object

PROPERTIES
NameTypeDescription

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
NameTypeDescription

name

string

Name of artist

type

[ string ]

Type of artist

debut

[ string ]

Debut daofte of artist

company

[ object ]

Company of album

PROPERTIES
NameTypeDescription

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

localeCode:

object

class.jsline 203

Locale code of album

PROPERTIES
NameTypeDescription

kr

string

Code for Korean

en

string

Code for English

Static Methods

getDescription(album)class.jsline 100

Returns description about album.

PARAMETERS
NameTypeDescription

album

Album

Instance of Album class

RETURNS:
{

string

} - Description
EXAMPLES
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

getArtist()class.jsline 184

Returns artist information of album.

RETURNS:
{

object

} - Artist object

getCompany()class.jsline 192

Returns company information of album.

RETURNS:
{

} - Company object

getGenres()class.jsline 153

Returns genres of album.

RETURNS:
{

string

} - Genres joined with comma
EXAMPLES
const instance = new Album({
  // ...
  genre: ['Pop', 'Jazz']
});

instance.getGenres(); // "Pop,Jazz"

getPlayTime(formatted)class.jsline 170

Returns play time of all songs.

PARAMETERS
NameTypeDescription

formatted

boolean

Whether use formatted play time or not

RETURNS:
{

numberstring

} - Play time
EXAMPLES
const instance = new Album({
  // ...
  playTime: 3600
});

instance.getPlayTime(); // 3600
instance.getPlayTime(true); // "01:00:00"

getTitle()class.jsline 138

Returns title of album.

RETURNS:
{

string

} - Title

deprecatedsetActivate(active)class.jsline 120

Sets active state of album.

PARAMETERS
NameTypeDescription

active

boolean

Whether album is active or not

setActive(active)class.jsline 111

Sets active state of album.

PARAMETERS
NameTypeDescription

active

boolean

Whether album is active or not

Events

activeevent.jsline 1

Occurs when active state is changed.

PROPERTIES
NameTypeDescription

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
});
Resizable