WBE_Praktikum_4/jasmine_demo/lib/jasmine_examples/Player.js

25 lines
472 B
JavaScript
Raw Permalink Normal View History

2022-10-20 10:56:45 +02:00
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;