You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
472 B
25 lines
472 B
4 years ago
|
function Player() {
|
||
|
}
|
||
|
Player.prototype.play = function(song) {
|
||
|
this.currentlyPlayingSong = song;
|
||
|
this.isPlaying = true;
|
||
|
};
|
||
|
|
||
|
Player.prototype.pause = function() {
|
||
|
this.isPlaying = false;
|
||
|
};
|
||
|
|
||
|
Player.prototype.resume = function() {
|
||
|
if (this.isPlaying) {
|
||
|
throw new Error("song is already playing");
|
||
|
}
|
||
|
|
||
|
this.isPlaying = true;
|
||
|
};
|
||
|
|
||
|
Player.prototype.makeFavorite = function() {
|
||
|
this.currentlyPlayingSong.persistFavoriteStatus(true);
|
||
|
};
|
||
|
|
||
|
module.exports = Player;
|