mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
22 lines
445 B
JavaScript
22 lines
445 B
JavaScript
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);
|
|
}; |