Files
jasmine/lib/jasmine-core/example/src/Player.js
Steve Gravrock 44f331f43d Updated the style of the examples
* const/let instead of var
* classes
* pass our own eslint checks
2022-09-17 12:00:20 -07:00

23 lines
357 B
JavaScript

class Player {
play(song) {
this.currentlyPlayingSong = song;
this.isPlaying = true;
}
pause() {
this.isPlaying = false;
}
resume() {
if (this.isPlaying) {
throw new Error('song is already playing');
}
this.isPlaying = true;
}
makeFavorite() {
this.currentlyPlayingSong.persistFavoriteStatus(true);
}
}